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

Function show_deps

scripts/update_lib/cmd_deps.py:386–417  ·  view source on GitHub ↗

Show all dependency information for modules.

(
    names: list[str],
    cpython_prefix: str,
    lib_prefix: str,
    max_depth: int = 10,
)

Source from the content-addressed store, hash-verified

384
385
386def show_deps(
387 names: list[str],
388 cpython_prefix: str,
389 lib_prefix: str,
390 max_depth: int = 10,
391) -> None:
392 """Show all dependency information for modules."""
393 # Expand "all" to all module names
394 expanded_names = []
395 for name in names:
396 if name == "all":
397 expanded_names.extend(get_all_modules(cpython_prefix))
398 else:
399 expanded_names.append(name)
400
401 # Resolve and deduplicate names (preserving order)
402 seen: set[str] = set()
403 resolved_names: list[str] = []
404 for name in expanded_names:
405 for resolved in _resolve_module_name(name, cpython_prefix, lib_prefix):
406 if resolved not in seen:
407 seen.add(resolved)
408 resolved_names.append(resolved)
409
410 # Shared visited set across all modules
411 visited: set[str] = set()
412
413 for i, name in enumerate(resolved_names):
414 if i > 0:
415 print() # blank line between modules
416 for line in format_deps(name, cpython_prefix, lib_prefix, max_depth, visited):
417 print(line)
418
419
420def main(argv: list[str] | None = None) -> int:

Callers 1

mainFunction · 0.85

Calls 9

get_all_modulesFunction · 0.85
setFunction · 0.85
_resolve_module_nameFunction · 0.85
enumerateFunction · 0.85
format_depsFunction · 0.85
printFunction · 0.50
extendMethod · 0.45
appendMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected