-
-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bugfix duplicate dataclass attributes #100
Bugfix duplicate dataclass attributes #100
Conversation
@pawamoy Note that poetry environment setup is currently not possible due to a bug: python-poetry/poetry#534 My fix locally was to pin |
Thanks a lot @bstadlbauer!
Yes I saw that too yesterday and used the same fix in other projects 🙂 Your PR is LGTM! A nice fix with few changes 🙂 |
It would be nice if you could fix CI cause I had six tests failing locally due to a weird import error :-) Also, i hope it was ok to add |
Alright, lets fix that then! And yes, thank you for adding marshmallow, I guess I had it locally installed without Poetry knowing. |
OK you can rebase on master to get the Poetry/pytest-randomly fix 🙂 |
b560e99
to
2386ab5
Compare
Rebased, but it looks as if the tests i saw failing locally are also failing here (and I think on master aswell). Also, it seems as if code quality checking is exiting with a non-zero status code, but the test is marked as ok?
|
Note: Just checked and seems as if there are 125 linting errors on master at the moment: ➜ pytkdocs git:(master) ✗ poetry run flakehell lint src | wc -l
125 |
Don't pay attention to the |
However I'm not sure why the test suite doesn't pass anymore... |
Just just saw the same - adding it locally and testing again |
Works locally - added it here aswell, let's see if CI likes it |
Looks good :-) There is nothing more from my side, so ready to merge |
Thanks again! |
This should fix the issue of dataclasses having duplicate attributes when these have defaults. This occurs because attributes with defaults are interpreted differently by Python (as they have a default, they already "exist" in the "regular" class).
The solution implemented here first checks if the argument is already present in
self.arguments
(comparison by name). If it is, it replaces the old argument (as the new one has thedataclass_field
property set).