class documentation

Mix-in to mark all class-like values.

Method __new__ Prevent direct instantiation.
Method bases Undocumented
Method call Undocumented
Method call_init Undocumented
Method call_init_subclass Call init_subclass(cls) for all base classes.
Method call_metaclass_init Call the metaclass's __init__ method if it does anything interesting.
Method compute_attr_metadata Sets combined metadata based on inherited and own attrs.
Method compute_is_dynamic Undocumented
Method compute_mro Compute the class precedence list (mro) according to C3.
Method get_annotated_local Undocumented
Method get_own_abstract_methods Get the abstract methods defined by this class.
Method get_own_attributes Get the attributes defined by this class.
Method get_own_new Get this value's __new__ method, if it isn't object.__new__.
Method get_special_attribute Fetch a special attribute.
Method has_dynamic_attributes Undocumented
Method has_protocol_base Returns whether this class inherits directly from typing.Protocol.
Method init_mixin Mix-in equivalent of __init__.
Method is_test_class Undocumented
Method record_attr_ordering Records the order of attrs to write in the output pyi.
Method update_official_name Update the official name.
Class Variable overloads Undocumented
Instance Variable abstract_methods Undocumented
Instance Variable additional_init_methods Undocumented
Instance Variable cls Undocumented
Instance Variable metadata Undocumented
Instance Variable overrides_bool Undocumented
Instance Variable protocol_attributes Undocumented
Property all_formal_type_parameters Undocumented
Property annotations_dict Undocumented
Property is_abstract Undocumented
Property is_enum Undocumented
Property is_protocol Undocumented
Property is_typed_dict_class Undocumented
Method _call_method Undocumented
Method _call_new_and_init Call __new__ if it has been overridden on the given value.
Method _check_not_instantiable Report [not-instantiable] if the class cannot be instantiated.
Method _get_attrs_from_mro Traverse the MRO and collect base class attributes for metadata_key.
Method _get_class Undocumented
Method _get_inherited_metaclass Undocumented
Method _get_mro_attrs_for_attrs Traverse the MRO and collect base class attributes for metadata_key.
Method _has_explicit_abcmeta Undocumented
Method _has_implicit_abcmeta Whether the class should be considered implicitly abstract.
Method _init_abstract_methods Compute this class's abstract methods.
Method _init_overrides_bool Compute and cache whether the class sets its own boolean value.
Method _init_protocol_attributes Compute this class's protocol attributes.
Method _load_all_formal_type_parameters Load _all_formal_type_parameters.
Method _new_instance Returns a (possibly cached) instance of 'self'.
Method _recompute_attrs_type_from_mro Traverse the MRO and apply Generic type params to class attributes.
Instance Variable _all_formal_type_parameters Undocumented
Instance Variable _all_formal_type_parameters_loaded Undocumented
Instance Variable _instance_cache Undocumented
Instance Variable _official_name Undocumented
def __new__(cls, *unused_args, **unused_kwds): (source)

Prevent direct instantiation.

def call_init(self, node, value, args): (source)

Undocumented

def call_init_subclass(self, node): (source)

Call init_subclass(cls) for all base classes.

def call_metaclass_init(self, node): (source)

Call the metaclass's __init__ method if it does anything interesting.

def compute_attr_metadata(self, own_attrs, decorator): (source)

Sets combined metadata based on inherited and own attrs. Args: own_attrs: The attrs defined explicitly in this class decorator: The fully qualified decorator name Returns: The list of combined attrs.

def compute_is_dynamic(self): (source)

Undocumented

def compute_mro(self): (source)

Compute the class precedence list (mro) according to C3.

def get_annotated_local(self, name): (source)

Undocumented

def get_own_new(self, node, value): (source)

Get this value's __new__ method, if it isn't object.__new__. Args: node: The current node. value: A cfg.Binding containing this value. Returns: A tuple of (1) a node and (2) either a cfg.Variable of the special __new__ method, or None.

def has_dynamic_attributes(self): (source)

Undocumented

def has_protocol_base(self): (source)

Returns whether this class inherits directly from typing.Protocol. Subclasses that may inherit from Protocol should override this method.

def init_mixin(self, metaclass): (source)

Mix-in equivalent of __init__.

def is_test_class(self): (source)

Undocumented

def record_attr_ordering(self, own_attrs): (source)

Records the order of attrs to write in the output pyi.

def update_official_name(self, name: str): (source)

Update the official name.

overloads: tuple[str, ...] = (source)

Undocumented

abstract_methods = (source)

Undocumented

additional_init_methods: list = (source)

Undocumented

metadata: dict = (source)

Undocumented

overrides_bool: bool = (source)

Undocumented

protocol_attributes = (source)

Undocumented

@property
all_formal_type_parameters = (source)

Undocumented

@property
annotations_dict = (source)

Undocumented

@property
is_abstract = (source)

Undocumented

Undocumented

@property
is_protocol = (source)

Undocumented

@property
is_typed_dict_class = (source)

Undocumented

def _call_method(self, node, value, method_name, args): (source)

Undocumented

def _call_new_and_init(self, node, value, args): (source)

Call __new__ if it has been overridden on the given value.

def _check_not_instantiable(self): (source)

Report [not-instantiable] if the class cannot be instantiated.

def _get_attrs_from_mro(self, cls_attrs, metadata_key): (source)

Traverse the MRO and collect base class attributes for metadata_key.

def _get_class(self): (source)

Undocumented

def _get_inherited_metaclass(self): (source)

Undocumented

def _get_mro_attrs_for_attrs(self, cls_attrs, metadata_key): (source)

Traverse the MRO and collect base class attributes for metadata_key.

def _has_explicit_abcmeta(self): (source)

Undocumented

def _has_implicit_abcmeta(self): (source)

Whether the class should be considered implicitly abstract.

def _init_abstract_methods(self): (source)

Compute this class's abstract methods.

def _init_overrides_bool(self): (source)

Compute and cache whether the class sets its own boolean value.

def _init_protocol_attributes(self): (source)

Compute this class's protocol attributes.

def _load_all_formal_type_parameters(self): (source)

Load _all_formal_type_parameters.

def _new_instance(self, container, node, args): (source)

Returns a (possibly cached) instance of 'self'.

def _recompute_attrs_type_from_mro(self, all_attrs, type_params): (source)

Traverse the MRO and apply Generic type params to class attributes. This IS REQUIRED for dataclass instances that inherits from a Generic. Args: all_attrs: All __init__ attributes of a class. type_params: List of ParameterizedClass instances that will override TypeVar attributes in all_attrs.

_all_formal_type_parameters = (source)

Undocumented

_all_formal_type_parameters_loaded: bool = (source)

Undocumented

_instance_cache: dict = (source)

Undocumented

_official_name = (source)

Undocumented