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

Function match_glob

Tools/c-analyzer/c_common/fsutil.py:129–148  ·  view source on GitHub ↗
(filename, pattern)

Source from the content-addressed store, hash-verified

127# find files
128
129def match_glob(filename, pattern):
130 if fnmatch.fnmatch(filename, pattern):
131 return True
132
133 # fnmatch doesn't handle ** quite right. It will not match the
134 # following:
135 #
136 # ('x/spam.py', 'x/**/*.py')
137 # ('spam.py', '**/*.py')
138 #
139 # though it *will* match the following:
140 #
141 # ('x/y/spam.py', 'x/**/*.py')
142 # ('x/spam.py', '**/*.py')
143
144 if '**/' not in pattern:
145 return False
146
147 # We only accommodate the single-"**" case.
148 return fnmatch.fnmatch(filename, pattern.replace('**/', '', 1))
149
150
151def process_filenames(filenames, *,

Callers 1

_is_excludedFunction · 0.85

Calls 2

fnmatchMethod · 0.80
replaceMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…