MCPcopy
hub / github.com/python/mypy / deserialize

Method deserialize

mypy/nodes.py:1192–1222  ·  view source on GitHub ↗
(cls, data: JsonDict)

Source from the content-addressed store, hash-verified

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)

Callers

nothing calls this directly

Calls 5

BlockClass · 0.85
FuncDefClass · 0.85
set_flagsFunction · 0.85
getMethod · 0.45
deserializeMethod · 0.45

Tested by

no test coverage detected