-
-
Notifications
You must be signed in to change notification settings - Fork 113
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
Fix __parameters__ access in gen._generate_mapping #221
Fix __parameters__ access in gen._generate_mapping #221
Conversation
Alright, nice and easy. Add a changelog entry, make sure tests pass and in it goes ;) |
Looks good. There's a conflict since I merged something else in prior so please resolve that and I'll merge. I'll probably edit your changelog entry for brevity. Thanks! |
Codecov Report
@@ Coverage Diff @@
## main #221 +/- ##
===========================================
- Coverage 98.34% 87.74% -10.60%
===========================================
Files 16 16
Lines 723 718 -5
===========================================
- Hits 711 630 -81
- Misses 12 88 +76
Continue to review full report at Codecov.
|
32bcb3c
to
f24f946
Compare
There are Generic types in the typing modules from which you can inherit in your own classes which do not have an __parameters__ attribute, such classes are now ignored making gen._generate_mapping effectively a no-op in case the class do not have an __parameters__ attribute. As https://github.com/ilevkivskyi/typing_inspect/blob/8f6aa2075ba448ab322def454137e7c59b9b302d/typing_inspect.py#L405 is showing there are also cases where __parameters__ could be None, so I test for both cases, that it is None or that it does not exist. See Also: python-attrs#217
f24f946
to
b62813c
Compare
Cool! |
Test failures I believe are unrelated, and I fixed them yesterday. Merging this in, thanks! |
There are Generic types in the typing modules
from which you can inherit in your own classes
which do not have an parameters attribute,
such classes are now ignored making
gen._generate_mapping effectively a no-op
in case the class do not have an parameters
attribute.
As https://github.com/ilevkivskyi/typing_inspect/blob/8f6aa2075ba448ab322def454137e7c59b9b302d/typing_inspect.py#L405
is showing there are also cases where parameters
could be None, so I test for both cases, that it
is None or that it does not exist.
See Also:
#217