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.
| 3543 | |
| 3544 | |
| 3545 | class 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 |
no outgoing calls
no test coverage detected
searching dependent graphs…