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

Class SCC

mypy/build.py:216–243  ·  view source on GitHub ↗

A simple class that represents a strongly connected component (import cycle).

Source from the content-addressed store, hash-verified

214
215
216class SCC:
217 """A simple class that represents a strongly connected component (import cycle)."""
218
219 id_counter: ClassVar[int] = 0
220
221 def __init__(
222 self, ids: set[str], scc_id: int | None = None, deps: list[int] | None = None
223 ) -> None:
224 if scc_id is None:
225 self.id = SCC.id_counter
226 SCC.id_counter += 1
227 else:
228 self.id = scc_id
229 # Ids of modules in this cycle.
230 self.mod_ids = ids
231 # Direct dependencies, should be populated by the caller.
232 self.deps: set[int] = set(deps) if deps is not None else set()
233 # Direct dependencies that have not been processed yet.
234 # Should be populated by the caller. This set may change during graph
235 # processing, while the above stays constant.
236 self.not_ready_deps: set[int] = set()
237 # SCCs that (directly) depend on this SCC. Note this is a list to
238 # make processing order more predictable. Dependents will be notified
239 # that they may be ready in the order in this list.
240 self.direct_dependents: list[int] = []
241 # Rough estimate of how much time processing this SCC will take, this
242 # is used for more efficient scheduling across multiple build workers.
243 self.size_hint: int = MIN_SIZE_HINT
244
245
246# TODO: Get rid of BuildResult. We might as well return a BuildManager.

Callers 2

prepare_sccs_fullFunction · 0.85
readMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected