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

Method _find_changed

mypy/dmypy_server.py:885–915  ·  view source on GitHub ↗
(
        self, sources: list[BuildSource], changed_paths: AbstractSet[str]
    )

Source from the content-addressed store, hash-verified

883 return self._find_changed(sources, changed_paths)
884
885 def _find_changed(
886 self, sources: list[BuildSource], changed_paths: AbstractSet[str]
887 ) -> ChangesAndRemovals:
888 # Find anything that has been added or modified
889 changed = [
890 (source.module, source.path)
891 for source in sources
892 if source.path and source.path in changed_paths
893 ]
894
895 # Now find anything that has been removed from the build
896 modules = {source.module for source in sources}
897 omitted = [source for source in self.previous_sources if source.module not in modules]
898 removed = []
899 for source in omitted:
900 path = source.path
901 assert path
902 removed.append((source.module, path))
903
904 self.add_explicitly_new(sources, changed)
905
906 # Find anything that has had its module path change because of added or removed __init__s
907 last = {s.path: s.module for s in self.previous_sources}
908 for s in sources:
909 assert s.path
910 if s.path in last and last[s.path] != s.module:
911 # Mark it as removed from its old name and changed at its new name
912 removed.append((last[s.path], s.path))
913 changed.append((s.module, s.path))
914
915 return changed, removed
916
917 def add_explicitly_new(
918 self, sources: list[BuildSource], changed: list[tuple[str, str]]

Callers 2

update_changedMethod · 0.95
find_changedMethod · 0.95

Calls 2

add_explicitly_newMethod · 0.95
appendMethod · 0.80

Tested by

no test coverage detected