From 8ff596a95e313eb10a4f648f87087df33ec77cec Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sat, 5 Dec 2020 20:04:51 -0800 Subject: [PATCH] Add function is_glob. --- voussoirkit/winglob.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/voussoirkit/winglob.py b/voussoirkit/winglob.py index 2daa5a4..f3043ad 100644 --- a/voussoirkit/winglob.py +++ b/voussoirkit/winglob.py @@ -23,3 +23,11 @@ def fnmatch(name, pat): def glob(pathname, *, recursive=False): return python_glob.glob(fix(pathname), recursive=recursive) + +def is_glob(pattern): + ''' + Improvements can be made to consider [] ranges for unix, but properly + parsing the range syntax is not something I'm interested in doing right now + and it would become the largest function in the whole module. + ''' + return any(c in pattern for c in '*?')