(cls, data: JsonDict | str)
| 1704 | |
| 1705 | @classmethod |
| 1706 | def deserialize(cls, data: JsonDict | str) -> Instance: |
| 1707 | if isinstance(data, str): |
| 1708 | inst = Instance(NOT_READY, []) |
| 1709 | inst.type_ref = data |
| 1710 | return inst |
| 1711 | assert data[".class"] == "Instance" |
| 1712 | args: list[Type] = [] |
| 1713 | if "args" in data: |
| 1714 | args_list = data["args"] |
| 1715 | assert isinstance(args_list, list) |
| 1716 | args = [deserialize_type(arg) for arg in args_list] |
| 1717 | inst = Instance(NOT_READY, args) |
| 1718 | inst.type_ref = data["type_ref"] # Will be fixed up by fixup.py later. |
| 1719 | if "last_known_value" in data: |
| 1720 | inst.last_known_value = LiteralType.deserialize(data["last_known_value"]) |
| 1721 | if data.get("extra_attrs") is not None: |
| 1722 | inst.extra_attrs = ExtraAttrs.deserialize(data["extra_attrs"]) |
| 1723 | return inst |
| 1724 | |
| 1725 | def write(self, data: WriteBuffer) -> None: |
| 1726 | write_tag(data, INSTANCE) |
nothing calls this directly
no test coverage detected