Changeset 388 for python/vendor/current/Lib/fnmatch.py
- Timestamp:
- Mar 19, 2014, 11:11:30 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/vendor/current/Lib/fnmatch.py
r2 r388 13 13 import re 14 14 15 __all__ = ["filter", "fnmatch", "fnmatchcase","translate"]15 __all__ = ["filter", "fnmatch", "fnmatchcase", "translate"] 16 16 17 17 _cache = {} 18 _MAXCACHE = 100 19 20 def _purge(): 21 """Clear the pattern cache""" 22 _cache.clear() 18 23 19 24 def fnmatch(name, pat): … … 45 50 if not pat in _cache: 46 51 res = translate(pat) 52 if len(_cache) >= _MAXCACHE: 53 _cache.clear() 47 54 _cache[pat] = re.compile(res) 48 55 match=_cache[pat].match … … 67 74 if not pat in _cache: 68 75 res = translate(pat) 76 if len(_cache) >= _MAXCACHE: 77 _cache.clear() 69 78 _cache[pat] = re.compile(res) 70 79 return _cache[pat].match(name) is not None
Note:
See TracChangeset
for help on using the changeset viewer.