konradhalas / dacite

Simple creation of data classes from dictionaries.
MIT License
1.72k stars 107 forks source link

Support InitVar's fields #45

Closed acarrasco closed 4 years ago

acarrasco commented 5 years ago

Hi, I added support for InitVar fields (https://docs.python.org/3/library/dataclasses.html#init-only-variables).

acarrasco commented 5 years ago

I've reformatted the files with black locally, but the check is still failing... Maybe I am not using the same version as Travis?

acarrasco commented 5 years ago

fixed, I was only running black for dacite and not for tests :sweat_smile:

acarrasco commented 5 years ago

The coverage checker is a little bit broken :sweat_smile:

There was already 100% coverage, but it considered it went down because the total number of lines went down in a file, and so it went down the number of covered files as well (even though the ratio was still 1:1).

I force pushed some changes in the comments (to clarify why we are looking the type hints of the InitVars in the __post_init__ instead of __init__) and it went back to green :)

acarrasco commented 5 years ago

@konradhalas did you have a chance to review the PR?

cheers!

konradhalas commented 5 years ago

@acarrasco man, sorry, but I didn't have time. I promise I will review it ASAP (probably next week) but first of all I want to release version 1.0.0, this will go to 1.1.0 probably :)

konradhalas commented 4 years ago

@acarrasco once again thank you for your contribution. I implemented it in a bit different way (https://github.com/konradhalas/dacite/commit/d271539e29c9576a1ea6cb626c4e346daeeb2fdb) but it works quite well :)