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

Function get_soft_deps

scripts/update_lib/deps.py:989–1008  ·  view source on GitHub ↗

Get soft dependencies by parsing imports from library file. Args: name: Module name cpython_prefix: CPython directory prefix Returns: Frozenset of imported stdlib module names (those that exist in cpython/Lib/)

(name: str, cpython_prefix: str)

Source from the content-addressed store, hash-verified

987
988@functools.cache
989def get_soft_deps(name: str, cpython_prefix: str) -> frozenset[str]:
990 """Get soft dependencies by parsing imports from library file.
991
992 Args:
993 name: Module name
994 cpython_prefix: CPython directory prefix
995
996 Returns:
997 Frozenset of imported stdlib module names (those that exist in cpython/Lib/)
998 """
999 all_imports = get_all_imports(name, cpython_prefix)
1000
1001 # Filter: only include modules that exist in cpython/Lib/
1002 stdlib_deps = set()
1003 for imp in all_imports:
1004 module_path = resolve_module_path(imp, cpython_prefix)
1005 if module_path.exists():
1006 stdlib_deps.add(imp)
1007
1008 return frozenset(stdlib_deps)
1009
1010
1011@functools.cache

Callers 6

compute_todo_listFunction · 0.90
format_deps_treeFunction · 0.90
test_with_temp_filesMethod · 0.90
test_skips_selfMethod · 0.90
get_rust_depsFunction · 0.85

Calls 5

resolve_module_pathFunction · 0.90
get_all_importsFunction · 0.85
setFunction · 0.85
existsMethod · 0.45
addMethod · 0.45

Tested by 3

test_with_temp_filesMethod · 0.72
test_skips_selfMethod · 0.72