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

Class DeletedType

mypy/types.py:1488–1522  ·  view source on GitHub ↗

Type of deleted variables. These can be used as lvalues but not rvalues.

Source from the content-addressed store, hash-verified

1486
1487
1488class DeletedType(ProperType):
1489 """Type of deleted variables.
1490
1491 These can be used as lvalues but not rvalues.
1492 """
1493
1494 __slots__ = ("source",)
1495
1496 source: str | None # May be None; name that generated this value
1497
1498 def __init__(self, source: str | None = None, line: int = -1, column: int = -1) -> None:
1499 super().__init__(line, column)
1500 self.source = source
1501
1502 def accept(self, visitor: TypeVisitor[T]) -> T:
1503 return visitor.visit_deleted_type(self)
1504
1505 def serialize(self) -> JsonDict:
1506 return {".class": "DeletedType", "source": self.source}
1507
1508 @classmethod
1509 def deserialize(cls, data: JsonDict) -> DeletedType:
1510 assert data[".class"] == "DeletedType"
1511 return DeletedType(data["source"])
1512
1513 def write(self, data: WriteBuffer) -> None:
1514 write_tag(data, DELETED_TYPE)
1515 write_str_opt(data, self.source)
1516 write_tag(data, END_TAG)
1517
1518 @classmethod
1519 def read(cls, data: ReadBuffer) -> DeletedType:
1520 ret = DeletedType(read_str_opt(data))
1521 assert read_tag(data) == END_TAG
1522 return ret
1523
1524
1525# Fake TypeInfo to be used as a placeholder during Instance de-serialization.

Callers 5

visit_del_stmtMethod · 0.90
visit_deleted_typeMethod · 0.90
deserializeMethod · 0.85
readMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…