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

Function transitive_dep_hash

mypy/build.py:5092–5107  ·  view source on GitHub ↗

Compute stable snapshot of transitive import structure for given SCC.

(scc: SCC, graph: Graph)

Source from the content-addressed store, hash-verified

5090
5091
5092def transitive_dep_hash(scc: SCC, graph: Graph) -> bytes:
5093 """Compute stable snapshot of transitive import structure for given SCC."""
5094 all_direct_deps = sorted(
5095 {
5096 dep
5097 for id in scc.mod_ids
5098 for dep in graph[id].dependencies
5099 if graph[id].priorities.get(dep) != PRI_INDIRECT
5100 }
5101 )
5102 buf = WriteBuffer()
5103 for dep_id in all_direct_deps:
5104 write_str_bare(buf, dep_id)
5105 if dep_id not in scc.mod_ids:
5106 write_bytes_bare(buf, graph[dep_id].trans_dep_hash)
5107 return hash_digest_bytes(buf.getvalue())
5108
5109
5110def missing_stubs_file(cache_dir: str) -> str:

Callers 1

sorted_componentsFunction · 0.85

Calls 3

hash_digest_bytesFunction · 0.90
sortedFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…