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

Method defer_node

mypy/checker.py:733–744  ·  view source on GitHub ↗

Defer a node for processing during next type-checking pass. Args: node: function/method being deferred enclosing_class: for methods, the class where the method is defined NOTE: this can't handle nested functions/methods.

(self, node: DeferredNodeType, enclosing_class: TypeInfo | None)

Source from the content-addressed store, hash-verified

731 # TODO: Handle __all__
732
733 def defer_node(self, node: DeferredNodeType, enclosing_class: TypeInfo | None) -> None:
734 """Defer a node for processing during next type-checking pass.
735
736 Args:
737 node: function/method being deferred
738 enclosing_class: for methods, the class where the method is defined
739 NOTE: this can't handle nested functions/methods.
740 """
741 # We don't freeze the entire scope since only top-level functions and methods
742 # can be deferred. Only module/class level scope information is needed.
743 # Module-level scope information is preserved in the TypeChecker instance.
744 self.deferred_nodes.append(DeferredNode(node, enclosing_class))
745
746 def handle_cannot_determine_type(self, name: str, context: Context) -> None:
747 node = self.scope.top_level_function()

Calls 2

DeferredNodeClass · 0.85
appendMethod · 0.80

Tested by

no test coverage detected