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

Method read

mypy/nodes.py:1260–1299  ·  view source on GitHub ↗
(cls, data: ReadBuffer)

Source from the content-addressed store, hash-verified

1258
1259 @classmethod
1260 def read(cls, data: ReadBuffer) -> FuncDef:
1261 name = read_str(data)
1262 typ: mypy.types.FunctionLike | None = None
1263 tag = read_tag(data)
1264 if tag != LITERAL_NONE:
1265 typ = mypy.types.read_function_like(data, tag)
1266 ret = FuncDef(name, [], Block([]), typ)
1267 ret._fullname = read_str(data)
1268 (
1269 ret.is_property,
1270 ret.is_class,
1271 ret.is_static,
1272 ret.is_final,
1273 ret.is_overload,
1274 ret.is_generator,
1275 ret.is_coroutine,
1276 ret.is_async_generator,
1277 ret.is_awaitable_coroutine,
1278 ret.is_decorated,
1279 ret.is_conditional,
1280 ret.is_trivial_body,
1281 ret.is_trivial_self,
1282 ret.is_mypy_only,
1283 ) = read_flags(data, num_flags=14)
1284 # NOTE: ret.info is set in the fixup phase.
1285 ret.arg_names = read_str_opt_list(data)
1286 ret.arg_kinds = [ARG_KINDS[ak] for ak in read_int_list(data)]
1287 ret.abstract_status = read_int(data)
1288 tag = read_tag(data)
1289 if tag != LITERAL_NONE:
1290 assert tag == DT_SPEC
1291 ret.dataclass_transform_spec = DataclassTransformSpec.read(data)
1292 ret.deprecated = read_str_opt(data)
1293 ret.original_first_arg = read_str_opt(data)
1294 # Leave these uninitialized so that future uses will trigger an error
1295 del ret.arguments
1296 del ret.max_pos
1297 del ret.min_args
1298 assert read_tag(data) == END_TAG
1299 return ret
1300
1301
1302# All types that are both SymbolNodes and FuncBases. See the FuncBase

Callers

nothing calls this directly

Calls 9

read_strFunction · 0.90
read_str_opt_listFunction · 0.90
read_int_listFunction · 0.90
read_intFunction · 0.90
read_str_optFunction · 0.90
FuncDefClass · 0.85
BlockClass · 0.85
read_flagsFunction · 0.85
readMethod · 0.45

Tested by

no test coverage detected