MCPcopy
hub / github.com/numpy/numpy / find_c_cpp_files

Function find_c_cpp_files

tools/check_python_h_first.py:189–211  ·  view source on GitHub ↗
(root: str)

Source from the content-addressed store, hash-verified

187
188
189def find_c_cpp_files(root: str) -> list[str]:
190
191 result = []
192
193 for dirpath, dirnames, filenames in os.walk(root):
194 # I'm assuming other people have checked boost
195 for name in ("build", ".git", "boost"):
196 try:
197 dirnames.remove(name)
198 except ValueError:
199 pass
200 for name in fnmatch.filter(dirnames, "*.p"):
201 dirnames.remove(name)
202 result.extend(
203 [
204 os.path.join(dirpath, name)
205 for name in filenames
206 if os.path.splitext(name)[1].lower() in C_CPP_EXTENSIONS
207 ]
208 )
209 # Check the headers before the source files
210 result.sort(key=lambda path: "h" in os.path.splitext(path)[1], reverse=True)
211 return result
212
213
214def diff_files(sha: str) -> list[str]:

Callers 1

Calls 4

filterMethod · 0.80
joinMethod · 0.80
lowerMethod · 0.80
sortMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…