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

Method top_level_function

mypy/checker_shared.py:309–314  ·  view source on GitHub ↗

Return top-level non-lambda function.

(self)

Source from the content-addressed store, hash-verified

307 return None
308
309 def top_level_function(self) -> FuncItem | None:
310 """Return top-level non-lambda function."""
311 for e in self.stack:
312 if isinstance(e, FuncItem) and not isinstance(e, LambdaExpr):
313 return e
314 return None
315
316 def active_class(self) -> TypeInfo | None:
317 if isinstance(self.stack[-1], TypeInfo):

Calls 1

isinstanceFunction · 0.85

Tested by

no test coverage detected