Add winglob.glob_many.

master
voussoir 2021-09-23 22:34:34 -07:00
parent f10942fd3f
commit 85ea9ec660
No known key found for this signature in database
GPG Key ID: 5F7554F8C26DACCB
1 changed files with 8 additions and 0 deletions

View File

@ -25,6 +25,14 @@ def fnmatch(name, pat):
def glob(pathname, *, recursive=False): def glob(pathname, *, recursive=False):
return python_glob.glob(fix(pathname), recursive=recursive) return python_glob.glob(fix(pathname), recursive=recursive)
def glob_many(patterns, *, recursive=False):
'''
Given many glob patterns, yield the results as a single generator.
Saves you from having to write the nested loop.
'''
for pattern in patterns:
yield from glob(pattern, recursive=recursive)
def is_glob(pattern): def is_glob(pattern):
''' '''
Improvements can be made to consider [] ranges for unix, but properly Improvements can be made to consider [] ranges for unix, but properly