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

Class Scope

mypy/partially_defined.py:180–197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

178
179
180class Scope:
181 def __init__(self, stmts: list[BranchStatement], scope_type: ScopeType) -> None:
182 self.branch_stmts: list[BranchStatement] = stmts
183 self.scope_type = scope_type
184 self.undefined_refs: dict[str, set[NameExpr]] = {}
185
186 def copy(self) -> Scope:
187 result = Scope([s.copy() for s in self.branch_stmts], self.scope_type)
188 result.undefined_refs = self.undefined_refs.copy()
189 return result
190
191 def record_undefined_ref(self, o: NameExpr) -> None:
192 if o.name not in self.undefined_refs:
193 self.undefined_refs[o.name] = set()
194 self.undefined_refs[o.name].add(o)
195
196 def pop_undefined_ref(self, name: str) -> set[NameExpr]:
197 return self.undefined_refs.pop(name, set())
198
199
200class DefinedVariableTracker:

Callers 3

copyMethod · 0.70
__init__Method · 0.70
enter_scopeMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…