Add function is_glob.

This commit is contained in:
voussoir 2020-12-05 20:04:51 -08:00
parent bf2865077a
commit 8ff596a95e

View file

@ -23,3 +23,11 @@ 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 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 '*?')