MCPcopy
hub / github.com/python/mypy / TempNode

Class TempNode

mypy/nodes.py:3545–3575  ·  view source on GitHub ↗

Temporary dummy node used during type checking. This node is not present in the original program; it is just an artifact of the type checker implementation. It only represents an opaque node with some fixed type.

Source from the content-addressed store, hash-verified

3543
3544
3545class TempNode(Expression):
3546 """Temporary dummy node used during type checking.
3547
3548 This node is not present in the original program; it is just an artifact
3549 of the type checker implementation. It only represents an opaque node with
3550 some fixed type.
3551 """
3552
3553 __slots__ = ("type", "no_rhs")
3554
3555 type: mypy.types.Type
3556 # Is this TempNode used to indicate absence of a right hand side in an annotated assignment?
3557 # (e.g. for 'x: int' the rvalue is TempNode(AnyType(TypeOfAny.special_form), no_rhs=True))
3558 no_rhs: bool
3559
3560 def __init__(
3561 self, typ: mypy.types.Type, no_rhs: bool = False, *, context: Context | None = None
3562 ) -> None:
3563 """Construct a dummy node; optionally borrow line/column from context object."""
3564 super().__init__()
3565 self.type = typ
3566 self.no_rhs = no_rhs
3567 if context is not None:
3568 self.line = context.line
3569 self.column = context.column
3570
3571 def __repr__(self) -> str:
3572 return "TempNode:%d(%s)" % (self.line, str(self.type))
3573
3574 def accept(self, visitor: ExpressionVisitor[T]) -> T:
3575 return visitor.visit_temp_node(self)
3576
3577
3578# Special attributes not collected as protocol members by Python 3.12

Callers 15

flatten_rvaluesMethod · 0.90
temp_nodeMethod · 0.90
has_valid_attributeMethod · 0.90
expand_and_bind_callableFunction · 0.90
check_argument_countMethod · 0.90
check_opMethod · 0.90
visit_AnnAssignMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…