class documentation

class TypeInfo(SymbolNode): (source)

Known subclasses: mypy.nodes.FakeInfo

View In Hierarchy

The type structure of a single class. Each TypeInfo corresponds one-to-one to a ClassDef, which represents the AST of the class. In type-theory terms, this is a "type constructor", and if the class is generic then it will be a type constructor of higher kind. Where the class is used in an actual type, it's in the form of an Instance, which amounts to a type application of the tycon to the appropriate number of arguments.

Class Method deserialize Undocumented
Method __bool__ Undocumented
Method __getitem__ Undocumented
Method __init__ Initialize a TypeInfo.
Method __repr__ Undocumented
Method __str__ Return a string representation of the type.
Method add_type_vars Undocumented
Method calculate_metaclass_type Undocumented
Method direct_base_classes Return a direct base classes.
Method dump Return a string dump of the contents of the TypeInfo.
Method get Undocumented
Method get_containing_type_info Undocumented
Method get_method Undocumented
Method has_base Return True if type has a base type with the specified name.
Method has_readable_member Undocumented
Method is_generic Is the type generic (i.e. does it have type variables)?
Method is_metaclass Undocumented
Method serialize Undocumented
Method update_tuple_type Update tuple_type and special_alias as needed.
Method update_typeddict_type Update typeddict_type and special_alias as needed.
Constant FLAGS Undocumented
Class Variable __slots__ Undocumented
Instance Variable abstract_attributes Undocumented
Instance Variable alt_promote Undocumented
Instance Variable assuming Undocumented
Instance Variable assuming_proper Undocumented
Instance Variable bad_mro Undocumented
Instance Variable bases Undocumented
Instance Variable dataclass_transform_spec Undocumented
Instance Variable declared_metaclass Undocumented
Instance Variable defn Undocumented
Instance Variable deletable_attributes Undocumented
Instance Variable fallback_to_any Undocumented
Instance Variable has_param_spec_type Undocumented
Instance Variable has_type_var_tuple_type Undocumented
Instance Variable inferring Undocumented
Instance Variable is_abstract Undocumented
Instance Variable is_enum Undocumented
Instance Variable is_final Undocumented
Instance Variable is_intersection Undocumented
Instance Variable is_named_tuple Undocumented
Instance Variable is_newtype Undocumented
Instance Variable is_protocol Undocumented
Instance Variable meta_fallback_to_any Undocumented
Instance Variable metaclass_type Undocumented
Instance Variable metadata Undocumented
Instance Variable module_name Undocumented
Instance Variable mro Undocumented
Instance Variable names Undocumented
Instance Variable runtime_protocol Undocumented
Instance Variable self_type Undocumented
Instance Variable slots Undocumented
Instance Variable special_alias Undocumented
Instance Variable tuple_type Undocumented
Instance Variable type_var_tuple_prefix Undocumented
Instance Variable type_var_tuple_suffix Undocumented
Instance Variable type_vars Undocumented
Instance Variable typeddict_type Undocumented
Property fullname Undocumented
Property name Short name.
Property protocol_members Undocumented
Instance Variable _fullname Undocumented
Instance Variable _mro_refs Undocumented
Instance Variable _promote Undocumented

Inherited from Node (via SymbolNode):

Method accept Undocumented

Inherited from Context (via SymbolNode, Node):

Method set_line If target is a node, pull line (and column) information into this node. If column is specified, this will override any column information coming from a node.
Instance Variable column Undocumented
Instance Variable end_column Undocumented
Instance Variable end_line Undocumented
Instance Variable line Undocumented
@classmethod
def deserialize(cls, data: JsonDict) -> TypeInfo: (source)

Undocumented

def __bool__(self) -> bool: (source)

Undocumented

def __getitem__(self, name: str) -> SymbolTableNode: (source)

Undocumented

def __init__(self, names: SymbolTable, defn: ClassDef, module_name: str): (source)
overridden in mypy.nodes.FakeInfo

Initialize a TypeInfo.

def __repr__(self) -> str: (source)

Undocumented

def __str__(self) -> str: (source)

Return a string representation of the type. This includes the most important information about the type.

def add_type_vars(self): (source)

Undocumented

def calculate_metaclass_type(self) -> mypy.types.Instance|None: (source)

Undocumented

def direct_base_classes(self) -> list[TypeInfo]: (source)

Return a direct base classes. Omit base classes of other base classes.

def dump(self, str_conv: mypy.strconv.StrConv|None = None, type_str_conv: mypy.types.TypeStrVisitor|None = None) -> str: (source)

Return a string dump of the contents of the TypeInfo.

def get(self, name: str) -> SymbolTableNode|None: (source)

Undocumented

def get_containing_type_info(self, name: str) -> TypeInfo|None: (source)

Undocumented

def get_method(self, name: str) -> (FuncBase|Decorator)|None: (source)

Undocumented

def has_base(self, fullname: str) -> bool: (source)

Return True if type has a base type with the specified name. This can be either via extension or via implementation.

def has_readable_member(self, name: str) -> bool: (source)

Undocumented

def is_generic(self) -> bool: (source)

Is the type generic (i.e. does it have type variables)?

def is_metaclass(self) -> bool: (source)

Undocumented

def serialize(self) -> JsonDict: (source)

Undocumented

def update_tuple_type(self, typ: mypy.types.TupleType): (source)

Update tuple_type and special_alias as needed.

def update_typeddict_type(self, typ: mypy.types.TypedDictType): (source)

Update typeddict_type and special_alias as needed.

Undocumented

Value
['is_abstract',
 'is_enum',
 'fallback_to_any',
 'meta_fallback_to_any',
 'is_named_tuple',
 'is_newtype',
 'is_protocol',
...
__slots__: tuple[str, ...] = (source)
overridden in mypy.nodes.FakeInfo

Undocumented

abstract_attributes: list = (source)

Undocumented

alt_promote = (source)

Undocumented

assuming: list = (source)

Undocumented

assuming_proper: list = (source)

Undocumented

Undocumented

Undocumented

dataclass_transform_spec = (source)

Undocumented

declared_metaclass = (source)

Undocumented

Undocumented

deletable_attributes: list = (source)

Undocumented

fallback_to_any: bool = (source)

Undocumented

has_param_spec_type: bool = (source)

Undocumented

has_type_var_tuple_type: bool = (source)

Undocumented

inferring: list = (source)

Undocumented

is_abstract: bool = (source)

Undocumented

Undocumented

is_final: bool = (source)

Undocumented

is_intersection: bool = (source)

Undocumented

is_named_tuple: bool = (source)

Undocumented

is_newtype: bool = (source)

Undocumented

is_protocol: bool = (source)

Undocumented

meta_fallback_to_any: bool = (source)

Undocumented

metaclass_type = (source)

Undocumented

metadata: dict = (source)

Undocumented

module_name = (source)

Undocumented

Undocumented

Undocumented

runtime_protocol: bool = (source)

Undocumented

self_type = (source)

Undocumented

Undocumented

special_alias = (source)

Undocumented

tuple_type = (source)

Undocumented

type_var_tuple_prefix = (source)

Undocumented

type_var_tuple_suffix = (source)

Undocumented

type_vars: list = (source)

Undocumented

typeddict_type = (source)

Undocumented

@property
protocol_members: list[str] = (source)

Undocumented

_fullname = (source)

Undocumented

_mro_refs = (source)

Undocumented

_promote: list = (source)

Undocumented