dacite icon indicating copy to clipboard operation
dacite copied to clipboard

Make from_dict accept data with Mapping type instead of Dict

Open igorcoding opened this issue 5 years ago • 2 comments

Hello!

In my projects I often use dacite with objects that were returned from functions with Mapping[str, Any] in return annotation or MutableMapping[str, Any] which clashes with the from_dict signature that expects a Dict[str, Any] as a data type, and therefore forces to use typing.cast(dict, obj) every time.

Is it necessary to use a Dict as data type?

Thanks.

igorcoding avatar May 07 '20 12:05 igorcoding

Hi @igorcoding - thank you for reporting this issue :)

OFC you have right and it makes sense, I'll change it.

konradhalas avatar May 07 '20 14:05 konradhalas

Awesome! Thank you!

igorcoding avatar May 07 '20 14:05 igorcoding