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

Method serialize

mypy/types.py:1690–1703  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1688 )
1689
1690 def serialize(self) -> JsonDict | str:
1691 assert self.type is not None
1692 type_ref = self.type.fullname
1693 if not self.args and not self.last_known_value and not self.extra_attrs:
1694 return type_ref
1695 data: JsonDict = {
1696 ".class": "Instance",
1697 "type_ref": type_ref,
1698 "args": [arg.serialize() for arg in self.args],
1699 }
1700 if self.last_known_value is not None:
1701 data["last_known_value"] = self.last_known_value.serialize()
1702 data["extra_attrs"] = self.extra_attrs.serialize() if self.extra_attrs else None
1703 return data
1704
1705 @classmethod
1706 def deserialize(cls, data: JsonDict | str) -> Instance:

Callers

nothing calls this directly

Calls 1

serializeMethod · 0.45

Tested by

no test coverage detected