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

Function generate_deps_for_cache

mypy/build.py:1695–1720  ·  view source on GitHub ↗

Generate fine-grained dependencies into a form suitable for serializing. This does a couple things: 1. Splits fine-grained deps based on the module of the trigger 2. For each module we generated fine-grained deps for, load any previous deps and merge them in. Returns a dicti

(manager: BuildManager, graph: Graph)

Source from the content-addressed store, hash-verified

1693
1694
1695def generate_deps_for_cache(manager: BuildManager, graph: Graph) -> dict[str, dict[str, set[str]]]:
1696 """Generate fine-grained dependencies into a form suitable for serializing.
1697
1698 This does a couple things:
1699 1. Splits fine-grained deps based on the module of the trigger
1700 2. For each module we generated fine-grained deps for, load any previous
1701 deps and merge them in.
1702
1703 Returns a dictionary from module ids to all dependencies on that
1704 module. Dependencies not associated with a module in the build will be
1705 associated with the nearest parent module that is in the build, or the
1706 fake module FAKE_ROOT_MODULE if none are.
1707 """
1708 from mypy.server.deps import merge_dependencies # Lazy import to speed up startup
1709
1710 # Split the dependencies out into based on the module that is depended on.
1711 rdeps = invert_deps(manager.fg_deps, graph)
1712
1713 # We can't just clobber existing dependency information, so we
1714 # load the deps for every module we've generated new dependencies
1715 # to and merge the new deps into them.
1716 for module, mdeps in rdeps.items():
1717 old_deps = manager.load_fine_grained_deps(module)
1718 merge_dependencies(old_deps, mdeps)
1719
1720 return rdeps
1721
1722
1723PLUGIN_SNAPSHOT_FILE: Final = "@plugins_snapshot.json"

Callers 1

dispatchFunction · 0.85

Calls 4

merge_dependenciesFunction · 0.90
invert_depsFunction · 0.85
itemsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…