-
-
Notifications
You must be signed in to change notification settings - Fork 118
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
Allow overriding unstruct_collection_overrides in preconf make_converter #350
Comments
Howdy, I think it's an oversight. Could you change the lines: kwargs["unstruct_collection_overrides"] = {
**kwargs.get("unstruct_collection_overrides", {}),
AbstractSet: list,
Counter: dict,
} to kwargs["unstruct_collection_overrides"] = {
AbstractSet: list,
Counter: dict,
**kwargs.get("unstruct_collection_overrides", {}),
} , add a small test and submit a PR? |
Hi. I'll work on a PR. Thanks for the quick response! |
ericbn
added a commit
to ericbn/cattrs
that referenced
this issue
Apr 12, 2023
ericbn
added a commit
to ericbn/cattrs
that referenced
this issue
Apr 12, 2023
Tinche
pushed a commit
that referenced
this issue
Apr 14, 2023
* Allow overriding unstruct_collection_overrides Fixes #350 * Update HISTORY.md
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
What I was trying to do:
This didn't work because
cattrs.preconf.json.make_converter
overrides thekwargs
:cattrs/src/cattrs/preconf/json.py
Lines 40 to 44 in 5ccd616
Then I tried:
But later in the code I call
json_converter.dumps
and mypy complainederror: "Converter" has no attribute "dumps" [attr-defined]
becausecopy
returns aConverter
.What I Did
Maybe the two forms that I've tried above should also be allowed?
The text was updated successfully, but these errors were encountered: