Test whether FILENAME matches PATTERN, including case. This is a version of fnmatch() which doesn't case-normalize its arguments.
(name, pat)
| 45 | |
| 46 | |
| 47 | def fnmatchcase(name, pat): |
| 48 | """Test whether FILENAME matches PATTERN, including case. |
| 49 | This is a version of fnmatch() which doesn't case-normalize |
| 50 | its arguments. |
| 51 | """ |
| 52 | |
| 53 | try: |
| 54 | re_pat = _cache[pat] |
| 55 | except KeyError: |
| 56 | res = translate(pat) |
| 57 | if len(_cache) >= _MAXCACHE: |
| 58 | _cache.clear() |
| 59 | _cache[pat] = re_pat = re.compile(res) |
| 60 | return re_pat.match(name) is not None |
| 61 | |
| 62 | |
| 63 | def translate(pat): |