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

Class GraphMessage

mypy/build.py:5383–5413  ·  view source on GitHub ↗

A message wrapping the build graph computed by the coordinator.

Source from the content-addressed store, hash-verified

5381
5382
5383class GraphMessage(IPCMessage):
5384 """A message wrapping the build graph computed by the coordinator."""
5385
5386 def __init__(self, *, graph: Graph, missing_modules: dict[str, int]) -> None:
5387 self.graph = graph
5388 self.missing_modules = missing_modules
5389 # Send this data separately as it will be lost during state serialization.
5390 self.from_cache = {mod_id for mod_id in graph if graph[mod_id].meta}
5391
5392 @classmethod
5393 def read(cls, buf: ReadBuffer, manager: BuildManager | None = None) -> GraphMessage:
5394 assert manager is not None
5395 graph = {read_str_bare(buf): State.read(buf, manager) for _ in range(read_int_bare(buf))}
5396 missing_modules = {read_str_bare(buf): read_int(buf) for _ in range(read_int_bare(buf))}
5397 message = GraphMessage(graph=graph, missing_modules=missing_modules)
5398 message.from_cache = {read_str_bare(buf) for _ in range(read_int_bare(buf))}
5399 return message
5400
5401 def write(self, buf: WriteBuffer) -> None:
5402 write_tag(buf, GRAPH_MESSAGE)
5403 write_int_bare(buf, len(self.graph))
5404 for mod_id, state in self.graph.items():
5405 write_str_bare(buf, mod_id)
5406 state.write(buf)
5407 write_int_bare(buf, len(self.missing_modules))
5408 for module, reason in self.missing_modules.items():
5409 write_str_bare(buf, module)
5410 write_int(buf, reason)
5411 write_int_bare(buf, len(self.from_cache))
5412 for module in self.from_cache:
5413 write_str_bare(buf, module)

Callers 2

process_graphFunction · 0.85
readMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…