Upload dataclass.py with huggingface_hub
Browse files311 unmodified lines3123133143153163173183193203213223233243253263 unmodified lines330331332333334335336337338311 unmodified linesallowing checks and alterations to be made at the time of class creation, providing more control.Example:```class Parent(Dataclass):final_field: int = FinalField(1) # this field cannot be overriddenrequired_field: str = RequiredField()also_required_field: floatabstract_field: int = AbstractField()class Child(Parent):abstract_field = 3 # now once overridden, this is no longer abstractrequired_field = Field(name="required_field", default="provided", type=str)class Mixin(Dataclass):3 unmodified linespassgrand_child = GrandChild()logging.info(grand_child.to_dict())```"""__allow_unexpected_arguments__ = False311 unmodified lines3123133143153163173183193203213223233243253263273283 unmodified lines332333334335336337338339340311 unmodified linesallowing checks and alterations to be made at the time of class creation, providing more control.Example:.. highlight:: python.. code-block:: pythonclass Parent(Dataclass):final_field: int = FinalField(1) # this field cannot be overriddenrequired_field: str = RequiredField()also_required_field: floatabstract_field: int = AbstractField()class Child(Parent):abstract_field = 3 # now once overridden, this is no longer abstractrequired_field = Field(name="required_field", default="provided", type=str)class Mixin(Dataclass):3 unmodified linespassgrand_child = GrandChild()logger.info(grand_child.to_dict())..."""__allow_unexpected_arguments__ = False
dataclass.py+7-5