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

Class ClassDef

mypy/nodes.py:1646–1767  ·  view source on GitHub ↗

Class definition

Source from the content-addressed store, hash-verified

1644
1645
1646class ClassDef(Statement):
1647 """Class definition"""
1648
1649 __slots__ = (
1650 "name",
1651 "_fullname",
1652 "defs",
1653 "type_args",
1654 "type_vars",
1655 "base_type_exprs",
1656 "removed_base_type_exprs",
1657 "info",
1658 "metaclass",
1659 "decorators",
1660 "keywords",
1661 "analyzed",
1662 "has_incompatible_baseclass",
1663 "docstring",
1664 "removed_statements",
1665 )
1666
1667 __match_args__ = ("name", "defs")
1668
1669 name: str # Name of the class without module prefix
1670 _fullname: str # Fully qualified name of the class
1671 defs: Block
1672 # New-style type parameters (PEP 695), unanalyzed
1673 type_args: list[TypeParam] | None
1674 # Semantically analyzed type parameters (all syntax variants)
1675 type_vars: list[mypy.types.TypeVarLikeType]
1676 # Base class expressions (not semantically analyzed -- can be arbitrary expressions)
1677 base_type_exprs: list[Expression]
1678 # Special base classes like Generic[...] get moved here during semantic analysis
1679 removed_base_type_exprs: list[Expression]
1680 info: TypeInfo # Related TypeInfo
1681 metaclass: Expression | None
1682 decorators: list[Expression]
1683 keywords: dict[str, Expression]
1684 analyzed: Expression | None
1685 has_incompatible_baseclass: bool
1686 # Used by special forms like NamedTuple and TypedDict to store invalid statements
1687 removed_statements: list[Statement]
1688
1689 def __init__(
1690 self,
1691 name: str,
1692 defs: Block,
1693 type_vars: list[mypy.types.TypeVarLikeType] | None = None,
1694 base_type_exprs: list[Expression] | None = None,
1695 metaclass: Expression | None = None,
1696 keywords: list[tuple[str, Expression]] | None = None,
1697 type_args: list[TypeParam] | None = None,
1698 ) -> None:
1699 super().__init__()
1700 self.name = name
1701 self._fullname = ""
1702 self.defs = defs
1703 self.type_vars = type_vars or []

Callers 15

make_fake_typeinfoMethod · 0.90
visit_ClassDefMethod · 0.90
missing_infoFunction · 0.90
basic_new_typeinfoMethod · 0.90
visit_class_defMethod · 0.90
read_class_defFunction · 0.90
make_type_infoMethod · 0.90
add_info_hookFunction · 0.90
add_info_hookFunction · 0.90
as_manager_hookFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…