Showing posts with the label python-dataclasses

[FIXED] MyPy fails dataclass argument with optional list of objects type

Issue I'm having trouble getting MyPy to pass my script which contains a dataclass Bar with a…

[FIXED] How can i type hint the init params are the same as fields in a dataclass?

Issue Let us say I have a custom use case, and I need to dynamically create or define the __init__ …

[FIXED] Building and using new data types in Python

Issue How do you build custom data types in Python (similar to how you define interface in TypeScr…

[FIXED] Confusing behavior when using TypeVar with dataclass

Issue If I define a type like the following: StringType = TypeVar('StringType', str, None)…

[FIXED] Is there an alias or name parameter for dataclass arguments?

Issue I have a class that accepts a lot of params, and in init method I'm loading them in diffe…

[FIXED] Validating detailed types in python dataclasses

Issue Python 3.7 was released a while ago, and I wanted to test some of the fancy new dataclass +ty…

[FIXED] Making classfactory that derive from dataclass objects informed by types in python

Issue When using dataclasses.dataclass the type information informs how parameters are parsed. I w…

[FIXED] How to avoid unexpected argument warning using data classes

Issue I have the following simple code. @dataclass(frozen=True) class Test: a: bool = True …

[FIXED] How to get the type of a validated field in Pydantic validator method

Issue I want to assign a value of None to a field that fails to validate in Pydantic. The validator…

[FIXED] How to give a Pydantic list field a default value?

Issue I want to create a Pydantic model in which there is a list field, which left uninitialized ha…

[FIXED] How to make "keyword-only" fields with dataclasses?

Issue Since 3.0 there is support to make an argument keyword only: class S3Obj: def __init__…

[FIXED] Class inheritance in Python 3.7 dataclasses

Issue I'm currently trying my hands on the new dataclass constructions introduced in Python 3.7…

[FIXED] What are data classes and how are they different from common classes?

Issue With PEP 557 data classes are introduced into python standard library. They make use of th…

[FIXED] Dataclass not inheriting __eq__() method from its parent

Issue I have a parent dataclass and a sub-dataclass inherits the first class. I've redefined __…