MCPcopy Index your code
hub / github.com/RustPython/RustPython / get_cpython_dir

Function get_cpython_dir

scripts/update_lib/file_utils.py:208–215  ·  view source on GitHub ↗

Extract CPython directory from a path containing /Lib/.

(src_path: pathlib.Path)

Source from the content-addressed store, hash-verified

206
207
208def get_cpython_dir(src_path: pathlib.Path) -> pathlib.Path:
209 """Extract CPython directory from a path containing /Lib/."""
210 path_str = str(src_path).replace("\\", "/")
211 lib_marker = "/Lib/"
212 if lib_marker in path_str:
213 idx = path_str.index(lib_marker)
214 return pathlib.Path(path_str[:idx])
215 return pathlib.Path("cpython")
216
217
218# === Comparison utilities ===

Callers 4

mainFunction · 0.90

Calls 3

strFunction · 0.85
replaceMethod · 0.45
indexMethod · 0.45