Changeset 388 for python/vendor/current/Lib/glob.py
- Timestamp:
- Mar 19, 2014, 11:11:30 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/vendor/current/Lib/glob.py
r2 r388 6 6 import fnmatch 7 7 8 try: 9 _unicode = unicode 10 except NameError: 11 # If Python is built without Unicode support, the unicode type 12 # will not exist. Fake one. 13 class _unicode(object): 14 pass 15 8 16 __all__ = ["glob", "iglob"] 9 17 … … 11 19 """Return a list of paths matching a pathname pattern. 12 20 13 The pattern may contain simple shell-style wildcards a la fnmatch. 21 The pattern may contain simple shell-style wildcards a la 22 fnmatch. However, unlike fnmatch, filenames starting with a 23 dot are special cases that are not matched by '*' and '?' 24 patterns. 14 25 15 26 """ … … 19 30 """Return an iterator which yields the paths matching a pathname pattern. 20 31 21 The pattern may contain simple shell-style wildcards a la fnmatch. 32 The pattern may contain simple shell-style wildcards a la 33 fnmatch. However, unlike fnmatch, filenames starting with a 34 dot are special cases that are not matched by '*' and '?' 35 patterns. 22 36 23 37 """ … … 31 45 yield name 32 46 return 33 if has_magic(dirname): 47 # `os.path.split()` returns the argument itself as a dirname if it is a 48 # drive or UNC path. Prevent an infinite recursion if a drive or UNC path 49 # contains magic characters (i.e. r'\\?\C:'). 50 if dirname != pathname and has_magic(dirname): 34 51 dirs = iglob(dirname) 35 52 else: … … 50 67 if not dirname: 51 68 dirname = os.curdir 52 if isinstance(pattern, unicode) and not isinstance(dirname, unicode):69 if isinstance(pattern, _unicode) and not isinstance(dirname, unicode): 53 70 dirname = unicode(dirname, sys.getfilesystemencoding() or 54 71 sys.getdefaultencoding())
Note:
See TracChangeset
for help on using the changeset viewer.