Skip to content

beasteers/prodglob

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

prodglob

os and glob extensions with advanced path joining.

Install

pip install prodglob

Usage

from prodglob import prodglob, pathprod, prodmake

print('pathprod: creating a product of path items.')
for f in pathprod('base', ('a', 'b'), 'something', ('c', 'd')):
    print(f)
print()

print('prodglob: globbing over the product of path items.')
for f in prodglob('base', ('a', 'b'), 'something', ('c', 'd')):
    print(f)
fs = pathprod('base', ('a', 'b'), 'something', ('c', 'd'))
print('how many files exist?', sum(os.path.exists(f) for f in fs))
print()

print('prodmake: making directories from the product of path items.')
fs = prodmake('base', ('a', 'b'), 'something', ('c', 'd'))
print('how many files exist?', sum(os.path.exists(f) for f in fs))
print()

print('prodglob: globbing over the product of path items.')
for f in prodglob('base', ('a', 'b'), 'something', ('c', 'd')):
    print(f)

Outputs:

pathprod: creating a product of path items.
base/a/something/c
base/a/something/d
base/b/something/c
base/b/something/d

prodglob: globbing over the product of path items.
how many files exist? 0

prodmake: making directories from the product of path items.
how many files exist? 4

prodglob: globbing over the product of path items.
base/a/something/c
base/a/something/d
base/b/something/c
base/b/something/d

About

os and glob extensions with advanced path joining.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages