diff options
Diffstat (limited to 'Lib/glob.py')
-rw-r--r-- | Lib/glob.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/glob.py b/Lib/glob.py index 33ee43b..c9f8117 100644 --- a/Lib/glob.py +++ b/Lib/glob.py @@ -57,8 +57,8 @@ def glob1(dirname, pattern): names = os.listdir(dirname) except OSError: return [] - if pattern[0] != '.': - names = [x for x in names if x[0] != '.'] + if not _ishidden(pattern): + names = [x for x in names if not _ishidden(x)] return fnmatch.filter(names, pattern) def glob0(dirname, basename): @@ -82,3 +82,6 @@ def has_magic(s): else: match = magic_check.search(s) return match is not None + +def _ishidden(path): + return path[0] in ('.', b'.'[0]) |