-
Notifications
You must be signed in to change notification settings - Fork 2
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
Changed typing to work with the --disallow-any-generics
flag on vistautils
#73
Conversation
I forgot to run |
Got rid of type alias IT and IT2 - Type aliases which use generics are themselves generics meaning they receive implicit `Any`s unless the typing is specified. As such type alias IT and IT2 are semi redundant as using them properly would be `IT[KT, VT]` making the typing almost as long as using `Tuple` and making it less readable (unless there was something there I didn't see)
Codecov Report
@@ Coverage Diff @@
## master #73 +/- ##
==========================================
- Coverage 89.34% 89.31% -0.04%
==========================================
Files 7 7
Lines 676 674 -2
==========================================
- Hits 604 602 -2
Misses 72 72 Continue to review full report at Codecov.
|
@gabbard I'm still unable to request review from @lichmaster98. |
GitHub says he has not yet accepted the invite. |
Apologies! I thought I had accepted this. |
InstantiationTypes = (Mapping, Iterable) # pylint:disable=invalid-name | ||
|
||
|
||
def immutabledict( | ||
iterable: Optional[AllowableSourceType] = None, *, forbid_duplicate_keys: bool = False | ||
iterable: Optional[AllowableSourceType[Any, Any]] = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if you use KT, VT
instead of Any, Any
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It throws errors on vistautils
saying that typing doesn't match. For some reason it tries to match to KT
and VT
exactly instead of using them as typevar
s. This can be seen as the original fix committed used typevar
s directly which mypy
was okay with despite it being a syntax error on the typing. Furthermore, the errors thrown by mypy when using KT, VT
were not errors from the flags so everyone who uses immutablecollections
would be affected even if we just # type: ignore
ed on vistautils
. @gabbard
Let's put this on hold until python/mypy#5738 is fixed. |
Closes #72