(cls, data: JsonDict)
| 1190 | |
| 1191 | @classmethod |
| 1192 | def deserialize(cls, data: JsonDict) -> FuncDef: |
| 1193 | assert data[".class"] == "FuncDef" |
| 1194 | body = Block([]) |
| 1195 | ret = FuncDef( |
| 1196 | data["name"], |
| 1197 | [], |
| 1198 | body, |
| 1199 | ( |
| 1200 | None |
| 1201 | if data["type"] is None |
| 1202 | else cast(mypy.types.FunctionLike, mypy.types.deserialize_type(data["type"])) |
| 1203 | ), |
| 1204 | ) |
| 1205 | ret._fullname = data["fullname"] |
| 1206 | set_flags(ret, data["flags"]) |
| 1207 | # NOTE: ret.info is set in the fixup phase. |
| 1208 | ret.arg_names = data["arg_names"] |
| 1209 | ret.original_first_arg = data.get("original_first_arg") |
| 1210 | ret.arg_kinds = [ARG_KINDS[x] for x in data["arg_kinds"]] |
| 1211 | ret.abstract_status = data["abstract_status"] |
| 1212 | ret.dataclass_transform_spec = ( |
| 1213 | DataclassTransformSpec.deserialize(data["dataclass_transform_spec"]) |
| 1214 | if data["dataclass_transform_spec"] is not None |
| 1215 | else None |
| 1216 | ) |
| 1217 | ret.deprecated = data["deprecated"] |
| 1218 | # Leave these uninitialized so that future uses will trigger an error |
| 1219 | del ret.arguments |
| 1220 | del ret.max_pos |
| 1221 | del ret.min_args |
| 1222 | return ret |
| 1223 | |
| 1224 | def write(self, data: WriteBuffer) -> None: |
| 1225 | write_tag(data, FUNC_DEF) |
nothing calls this directly
no test coverage detected