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

Function get_all_hard_deps

scripts/update_lib/deps.py:918–942  ·  view source on GitHub ↗

Get all hard_deps for a module (explicit + auto-detected). Args: name: Module name (e.g., "decimal", "datetime") cpython_prefix: CPython directory prefix Returns: List of hard_dep names (without .py extension)

(name: str, cpython_prefix: str)

Source from the content-addressed store, hash-verified

916
917
918def get_all_hard_deps(name: str, cpython_prefix: str) -> list[str]:
919 """Get all hard_deps for a module (explicit + auto-detected).
920
921 Args:
922 name: Module name (e.g., "decimal", "datetime")
923 cpython_prefix: CPython directory prefix
924
925 Returns:
926 List of hard_dep names (without .py extension)
927 """
928 dep_info = DEPENDENCIES.get(name, {})
929 hard_deps = set()
930
931 # Explicit hard_deps from DEPENDENCIES
932 for hd in dep_info.get("hard_deps", []):
933 # Remove .py extension if present
934 hard_deps.add(hd[:-3] if hd.endswith(".py") else hd)
935
936 # Auto-detect _py{module}.py or _py_{module}.py patterns
937 for pattern in [f"_py{name}.py", f"_py_{name}.py"]:
938 auto_path = construct_lib_path(cpython_prefix, pattern)
939 if auto_path.exists():
940 hard_deps.add(auto_path.stem)
941
942 return sorted(hard_deps)
943
944
945@functools.cache

Callers 1

compute_todo_listFunction · 0.90

Calls 7

construct_lib_pathFunction · 0.90
setFunction · 0.85
sortedFunction · 0.85
getMethod · 0.45
addMethod · 0.45
endswithMethod · 0.45
existsMethod · 0.45

Tested by

no test coverage detected