module documentation

Plugin that provides support for dataclasses.

Class DataclassAttribute No class docstring; 0/10 instance variable, 1/6 method, 0/1 class method documented
Class DataclassTransformer Implement the behavior of @dataclass.
Function add_dataclass_tag Undocumented
Function dataclass_class_maker_callback Hooks into the class typechecking process to add support for dataclasses.
Function dataclass_tag_callback Record that we have a dataclass in the main semantic analysis pass.
Constant dataclass_makers Undocumented
Constant SELF_TVAR_NAME Undocumented
Function _get_transform_spec Find the relevant transform parameters from the decorator/parent class/metaclass that triggered the dataclasses plugin.
Function _is_dataclasses_decorator Undocumented
Constant _TRANSFORM_SPEC_FOR_DATACLASSES Undocumented
def add_dataclass_tag(info: TypeInfo): (source)

Undocumented

def dataclass_class_maker_callback(ctx: ClassDefContext) -> bool: (source)

Hooks into the class typechecking process to add support for dataclasses.

def dataclass_tag_callback(ctx: ClassDefContext): (source)

Record that we have a dataclass in the main semantic analysis pass. The later pass implemented by DataclassTransformer will use this to detect dataclasses in base classes.

dataclass_makers: set[str] = (source)

Undocumented

Value
set(['dataclass', 'dataclasses.dataclass'])
SELF_TVAR_NAME: str = (source)

Undocumented

Value
'_DT'
def _get_transform_spec(reason: Expression) -> DataclassTransformSpec: (source)

Find the relevant transform parameters from the decorator/parent class/metaclass that triggered the dataclasses plugin. Although the resulting DataclassTransformSpec is based on the typing.dataclass_transform function, we also use it for traditional dataclasses.dataclass classes as well for simplicity. In those cases, we return a default spec rather than one based on a call to `typing.dataclass_transform`.

def _is_dataclasses_decorator(node: Node) -> bool: (source)

Undocumented

_TRANSFORM_SPEC_FOR_DATACLASSES = (source)

Undocumented

Value
DataclassTransformSpec(eq_default=True,
                       order_default=False,
                       kw_only_default=False,
                       frozen_default=False,
                       field_specifiers=('dataclasses.Field',
                                         'dataclasses.field'))