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

Function sort_order

tools/check_python_h_first.py:146–169  ·  view source on GitHub ↗
(path: str)

Source from the content-addressed store, hash-verified

144
145
146def sort_order(path: str) -> tuple[int, str]:
147 if "include/numpy" in path:
148 # Want to process numpy/*.h first, to work out which of those
149 # include Python.h directly
150 priority = 0x00
151 elif "h" in os.path.splitext(path)[1].lower():
152 # Then other headers, which tend to include numpy/*.h
153 priority = 0x10
154 else:
155 # Source files after headers, to give the best chance of
156 # properly checking whether they include Python.h
157 priority = 0x20
158 if "common" in path:
159 priority -= 8
160 path_basename = os.path.basename(path)
161 if path_basename.startswith("npy_"):
162 priority -= 4
163 elif path_basename.startswith("npy"):
164 priority -= 3
165 elif path_basename.startswith("np"):
166 priority -= 2
167 if "config" in path_basename:
168 priority -= 1
169 return priority, path
170
171
172def process_files(file_list: list[str]) -> int:

Callers

nothing calls this directly

Calls 2

lowerMethod · 0.80
startswithMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…