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

Function parse_lib_imports

scripts/update_lib/deps.py:127–134  ·  view source on GitHub ↗

Parse library file and extract all imported module names.

(content: str)

Source from the content-addressed store, hash-verified

125
126
127def parse_lib_imports(content: str) -> frozenset[str]:
128 """Parse library file and extract all imported module names."""
129 if not (tree := safe_parse_ast(content)):
130 return set()
131
132 visitor = ImportVisitor()
133 visitor.visit(tree)
134 return visitor.lib_imports
135
136
137# === TODO marker utilities ===

Callers 8

test_import_statementMethod · 0.90
test_from_importMethod · 0.90
test_mixed_importsMethod · 0.90
get_all_importsFunction · 0.85
_build_test_import_graphFunction · 0.85
_build_lib_import_graphFunction · 0.85

Calls 4

safe_parse_astFunction · 0.90
setFunction · 0.85
ImportVisitorClass · 0.85
visitMethod · 0.45

Tested by 5

test_import_statementMethod · 0.72
test_from_importMethod · 0.72
test_mixed_importsMethod · 0.72