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

Function prepare_sccs_full

mypy/build.py:5006–5025  ·  view source on GitHub ↗

Turn raw SCC sets into SCC objects and build dependency graph for SCCs.

(
    raw_sccs: Iterator[set[str]], edges: dict[str, list[str]]
)

Source from the content-addressed store, hash-verified

5004
5005
5006def prepare_sccs_full(
5007 raw_sccs: Iterator[set[str]], edges: dict[str, list[str]]
5008) -> dict[SCC, set[SCC]]:
5009 """Turn raw SCC sets into SCC objects and build dependency graph for SCCs."""
5010 sccs = [SCC(raw_scc) for raw_scc in raw_sccs]
5011 scc_map = {}
5012 for scc in sccs:
5013 for id in scc.mod_ids:
5014 scc_map[id] = scc
5015 scc_deps_map: dict[SCC, set[SCC]] = {}
5016 for scc in sccs:
5017 for id in scc.mod_ids:
5018 scc_deps_map.setdefault(scc, set()).update(scc_map[dep] for dep in edges[id])
5019 for scc in sccs:
5020 # Remove trivial dependency on itself.
5021 scc_deps_map[scc].discard(scc)
5022 for dep_scc in scc_deps_map[scc]:
5023 scc.deps.add(dep_scc.id)
5024 scc.not_ready_deps.add(dep_scc.id)
5025 return scc_deps_map
5026
5027
5028def sorted_components(graph: Graph) -> list[SCC]:

Callers 1

sorted_componentsFunction · 0.85

Calls 6

SCCClass · 0.85
setClass · 0.85
setdefaultMethod · 0.80
discardMethod · 0.80
updateMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…