MCPcopy Index your code
hub / github.com/python/mypy / ensure_deps_loaded

Function ensure_deps_loaded

mypy/server/update.py:501–517  ·  view source on GitHub ↗

Ensure that the dependencies on a module are loaded. Dependencies are loaded into the 'deps' dictionary. This also requires loading dependencies from any parent modules, since dependencies will get stored with parent modules when a module doesn't exist.

(module: str, deps: dict[str, set[str]], graph: dict[str, State])

Source from the content-addressed store, hash-verified

499
500
501def ensure_deps_loaded(module: str, deps: dict[str, set[str]], graph: dict[str, State]) -> None:
502 """Ensure that the dependencies on a module are loaded.
503
504 Dependencies are loaded into the 'deps' dictionary.
505
506 This also requires loading dependencies from any parent modules,
507 since dependencies will get stored with parent modules when a module
508 doesn't exist.
509 """
510 if module in graph and graph[module].fine_grained_deps_loaded:
511 return
512 parts = module.split(".")
513 for i in range(len(parts)):
514 base = ".".join(parts[: i + 1])
515 if base in graph and not graph[base].fine_grained_deps_loaded:
516 merge_dependencies(graph[base].load_fine_grained_deps(), deps)
517 graph[base].fine_grained_deps_loaded = True
518
519
520def ensure_trees_loaded(

Callers 3

update_moduleMethod · 0.85
find_targets_recursiveFunction · 0.85

Calls 6

merge_dependenciesFunction · 0.90
rangeClass · 0.85
lenFunction · 0.85
splitMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…