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)
| 916 | |
| 917 | |
| 918 | def 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 |
no test coverage detected