Repository navigation
Enable mypy option --disallow-any-generics - #2459
michaeloliverx wants to merge 10 commits into
Conversation
|
|
||
| if typing.TYPE_CHECKING: | ||
| from _typeshed import OptExcInfo # pragma: no cover | ||
| from _typeshed.wsgi import WSGIApplication # pragma: no cover |
There was a problem hiding this comment.
Could you talk me through these? It's confusing to me that _typeshed is named as a private module. Should we be replicating the definitions rather than importing them?
There was a problem hiding this comment.
There was a problem hiding this comment.
The _typeshed package and its types do not exist at runtime, but can be used freely in stubs (.pyi) files. To import the types from this package in implementation (.py) files, use the following construct:
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from _typeshed import ...There was a problem hiding this comment.
These are utility types used by the typeshed, I see no advantage in replicating them ourselves as mypy and pyright both ship with a recent copy of typeshed. These are strictly used for type checking and have no runtime implications.
Read more at https://github.com/python/typeshed/tree/main/stdlib/_typeshed.
There was a problem hiding this comment.
These particular types exist in python 3.11 under wsgiref.types so eventually we can remove them.
|
@tomchristie sorry I was out for a bit, this should be good to go now. |
|
Okay thanks, few more conflicts here. |
|
This has been covered by #2468 |
Refs #2436