dacite
dacite copied to clipboard
Simple creation of data classes from dictionaries.
Fixes #180 This is essentially the same fix as this one: https://github.com/ilevkivskyi/typing_inspect/pull/83
Since numpy 1.21 the `numpy.ndarray` class is generic for `mypy` and needs to be annotated with type parameters, and unfortunately this means that I cannot use `dacite.from_dict` any more when...
It's been over a year. Please create a new tagged release for [PyPi](https://pypi.org/project/dacite/).
If we have a dataclass like this: ``` class A(Enum): a = 'a' b = 'b' @dataclass class B: a: FrozenSet[A] ``` `from_dict()` will not cast values inside this frozenset:...
Hi, this is my proposal for fix #158 My idea is to extract types from InitVars for dataclass type_hints, as type_hint determines target type for value transformation. Type_hook never triggers...
### Example to reproduce faulty behavior: ```python from dataclasses import dataclass from typing import Optional, Union import dacite class A(int): pass class B(str): pass @dataclass class C: a_or_b: Optional[Union[A, B]]...
Consider: ``` from dataclasses import dataclass @dataclass class Widget: val: str = "test" x = from_dict(data_class=Widget, data={}). # No `val` at all, default value is used print(x) y = from_dict(data_class=Widget,...
Fix proposal for #168 Changes: - is_instance checks tuple values types only if dataclass type hint is actually Tuple - _build_value_for_collection returns () for empty tuple instead of (None,)
freezegun is a super common library used for testing and basically indispensable. But it seems when working with dacite, it can run into issues. As follows: ``` >>> from freezegun...
an IntEnum will be saved in json as a simple int, when loading a dataclass with an IntEnum it should be able to recognize the int as an intenum, but...