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

Function delete_module

mypy/server/update.py:713–733  ·  view source on GitHub ↗
(module_id: str, path: str, graph: Graph, manager: BuildManager)

Source from the content-addressed store, hash-verified

711
712
713def delete_module(module_id: str, path: str, graph: Graph, manager: BuildManager) -> None:
714 manager.log_fine_grained(f"delete module {module_id!r}")
715 # TODO: Remove deps for the module (this only affects memory use, not correctness)
716 if module_id in graph:
717 del graph[module_id]
718 if module_id in manager.modules:
719 del manager.modules[module_id]
720 components = module_id.split(".")
721 if len(components) > 1:
722 # Delete reference to module in parent module.
723 parent_id = ".".join(components[:-1])
724 # If parent module is ignored, it won't be included in the modules dictionary.
725 if parent_id in manager.modules:
726 parent = manager.modules[parent_id]
727 if components[-1] in parent.names:
728 del parent.names[components[-1]]
729 # If the module is removed from the build but still exists, then
730 # we mark it as missing so that it will get picked up by import from still.
731 if manager.fscache.isfile(path):
732 # TODO: check if there is an equivalent of #20800 for the daemon.
733 manager.missing_modules[module_id] = SuppressionReason.NOT_FOUND
734
735
736def dedupe_modules(modules: list[tuple[str, str]]) -> list[tuple[str, str]]:

Callers 1

update_module_isolatedFunction · 0.85

Calls 5

lenFunction · 0.85
log_fine_grainedMethod · 0.80
splitMethod · 0.80
joinMethod · 0.45
isfileMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…