From 85ea9ec66033bc121aa9a9606ca1016ea9626f44 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Thu, 23 Sep 2021 22:34:34 -0700 Subject: [PATCH] Add winglob.glob_many. --- voussoirkit/winglob.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/voussoirkit/winglob.py b/voussoirkit/winglob.py index 14e7234..0b26252 100644 --- a/voussoirkit/winglob.py +++ b/voussoirkit/winglob.py @@ -25,6 +25,14 @@ def fnmatch(name, pat): def glob(pathname, *, recursive=False): 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): ''' Improvements can be made to consider [] ranges for unix, but properly