MCPcopy Index your code
hub / github.com/python/cpython / fnmatch

Function fnmatch

Lib/fnmatch.py:22–39  ·  view source on GitHub ↗

Test whether FILENAME matches PATTERN. Patterns are Unix shell style: * matches everything ? matches any single character [seq] matches any character in seq [!seq] matches any char not in seq An initial period in FILENAME is not special. Both FILENAME an

(name, pat)

Source from the content-addressed store, hash-verified

20
21
22def fnmatch(name, pat):
23 """Test whether FILENAME matches PATTERN.
24
25 Patterns are Unix shell style:
26
27 * matches everything
28 ? matches any single character
29 [seq] matches any character in seq
30 [!seq] matches any char not in seq
31
32 An initial period in FILENAME is not special.
33 Both FILENAME and PATTERN are first case-normalized
34 if the operating system requires it.
35 If you don't want this, use fnmatchcase(FILENAME, PATTERN).
36 """
37 name = os.path.normcase(name)
38 pat = os.path.normcase(pat)
39 return fnmatchcase(name, pat)
40
41
42@functools.lru_cache(maxsize=32768, typed=True)

Calls 2

fnmatchcaseFunction · 0.85
normcaseMethod · 0.80

Tested by 2

Used in the wild real call sites across dependent graphs

searching dependent graphs…