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

Class FileStemSet

PC/layout/support/filesets.py:11–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9
10
11class FileStemSet:
12 def __init__(self, *patterns):
13 self._names = set()
14 self._prefixes = []
15 self._suffixes = []
16 for p in map(os.path.normcase, patterns):
17 if p.endswith("*"):
18 self._prefixes.append(p[:-1])
19 elif p.startswith("*"):
20 self._suffixes.append(p[1:])
21 else:
22 self._names.add(p)
23
24 def _make_name(self, f):
25 return os.path.normcase(f.stem)
26
27 def __contains__(self, f):
28 bn = self._make_name(f)
29 return (
30 bn in self._names
31 or any(map(bn.startswith, self._prefixes))
32 or any(map(bn.endswith, self._suffixes))
33 )
34
35
36class FileNameSet(FileStemSet):

Callers 1

main.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…