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

Method enter_scope

mypy/partially_defined.py:222–228  ·  view source on GitHub ↗
(self, scope_type: ScopeType)

Source from the content-addressed store, hash-verified

220 return self.scopes[-1]
221
222 def enter_scope(self, scope_type: ScopeType) -> None:
223 assert len(self._scope().branch_stmts) > 0
224 initial_state = None
225 if scope_type == ScopeType.Generator:
226 # Generators are special because they inherit the outer scope.
227 initial_state = self._scope().branch_stmts[-1].branches[-1]
228 self.scopes.append(Scope([BranchStatement(initial_state)], scope_type))
229
230 def exit_scope(self) -> None:
231 self.scopes.pop()

Callers 5

visit_funcMethod · 0.45
visit_generator_exprMethod · 0.45
visit_lambda_exprMethod · 0.45
visit_class_defMethod · 0.45

Calls 5

_scopeMethod · 0.95
lenFunction · 0.85
BranchStatementClass · 0.85
appendMethod · 0.80
ScopeClass · 0.70

Tested by

no test coverage detected