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

Method read

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

Source from the content-addressed store, hash-verified

1603
1604 @classmethod
1605 def read(cls, data: ReadBuffer) -> Var:
1606 name = read_str(data)
1607 typ = mypy.types.read_type_opt(data)
1608 v = Var(name, typ)
1609 setter_type: mypy.types.CallableType | None = None
1610 tag = read_tag(data)
1611 if tag != LITERAL_NONE:
1612 assert tag == mypy.types.CALLABLE_TYPE
1613 setter_type = mypy.types.CallableType.read(data)
1614 v.setter_type = setter_type
1615 v._fullname = read_str(data)
1616 (
1617 v.is_initialized_in_class,
1618 v.is_staticmethod,
1619 v.is_classmethod,
1620 v.is_property,
1621 v.is_settable_property,
1622 v.is_suppressed_import,
1623 v.is_classvar,
1624 v.is_abstract_var,
1625 v.is_final,
1626 v.is_index_var,
1627 v.final_unset_in_class,
1628 v.final_set_in_init,
1629 v.explicit_self_type,
1630 v.is_ready,
1631 v.is_inferred,
1632 v.invalid_partial_type,
1633 v.from_module_getattr,
1634 v.has_explicit_value,
1635 v.allow_incompatible_override,
1636 ) = read_flags(data, num_flags=19)
1637 tag = read_tag(data)
1638 if tag == LITERAL_COMPLEX:
1639 v.final_value = complex(read_float_bare(data), read_float_bare(data))
1640 elif tag != LITERAL_NONE:
1641 v.final_value = read_literal(data, tag)
1642 assert read_tag(data) == END_TAG
1643 return v
1644
1645
1646class ClassDef(Statement):

Callers 15

_parse_individual_fileFunction · 0.45
_find_moduleMethod · 0.45
parse_source_fileFunction · 0.45
mainFunction · 0.45
readMethod · 0.45
readMethod · 0.45
readMethod · 0.45
readMethod · 0.45
readMethod · 0.45
readMethod · 0.45

Calls 5

read_strFunction · 0.90
read_literalFunction · 0.90
VarClass · 0.85
read_flagsFunction · 0.85
complexClass · 0.85

Tested by 10

serverFunction · 0.36
test_connect_twiceMethod · 0.36
run_caseMethod · 0.36
verify_cacheMethod · 0.36
parse_moduleMethod · 0.36
add_fileMethod · 0.36