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

Method function_scope

mypy/scope.py:68–82  ·  view source on GitHub ↗
(self, fdef: FuncBase)

Source from the content-addressed store, hash-verified

66
67 @contextmanager
68 def function_scope(self, fdef: FuncBase) -> Iterator[None]:
69 self.functions.append(fdef)
70 if not self.function:
71 self.function = fdef
72 else:
73 # Nested functions are part of the topmost function target.
74 self.ignored += 1
75 yield
76 self.functions.pop()
77 if self.ignored:
78 # Leave a scope that's included in the enclosing target.
79 self.ignored -= 1
80 else:
81 assert self.function
82 self.function = None
83
84 def outer_functions(self) -> list[FuncBase]:
85 return self.functions[:-1]

Callers 12

saved_scopeMethod · 0.95
check_partialMethod · 0.80
check_partial_implMethod · 0.80
visit_func_def_implMethod · 0.80
visit_decorator_innerMethod · 0.80
visit_lambda_exprMethod · 0.80
visit_func_defMethod · 0.80
visit_funcMethod · 0.80
visit_func_defMethod · 0.80

Calls 2

appendMethod · 0.80
popMethod · 0.45

Tested by

no test coverage detected