MCPcopy Index your code
hub / github.com/numpy/numpy / iter_source_files

Function iter_source_files

tools/ci/check_c_api_usage.py:67–82  ·  view source on GitHub ↗

Return a list of source files under 'root', where filenames end with any of the extensions in 'exts' (e.g., '.c.src', '.c', '.h'). Excludes directories whose names are in 'excludes'.

(root: Path, exts: set[str], excludes: set[str])

Source from the content-addressed store, hash-verified

65 return ("".join(out_parts), in_block)
66
67def iter_source_files(root: Path, exts: set[str], excludes: set[str]) -> list[Path]:
68 """
69 Return a list of source files under 'root', where filenames end with any of the
70 extensions in 'exts' (e.g., '.c.src', '.c', '.h').
71 Excludes directories whose names are in 'excludes'.
72 """
73 results: list[Path] = []
74
75 for dirpath, dirnames, filenames in os.walk(root):
76 # Prune excluded directories
77 dirnames[:] = [d for d in dirnames if d not in excludes]
78 for fn in filenames:
79 # endswith handles mult-suffice patterns, e.g., .c.src
80 if any(fn.endswith(ext) for ext in exts):
81 results.append(Path(dirpath) / fn)
82 return results
83
84def build_func_rx(funcs: tuple[str, ...]) -> Pattern[str]:
85 return re.compile(r"(?<!\w)(?:" + "|".join(map(re.escape, funcs)) + r")(?!\w)")

Callers 1

mainFunction · 0.85

Calls 2

anyFunction · 0.85
endswithMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…