Closed edgarrmondragon closed 1 month ago
FWIW it seems the pre-commit hook for mypy is missing a bunch of actual typing problems, but it's probably beyond the scope of this PR to fix those:
$ mypy aiodocker tests
aiodocker/stream.py:83: error: Item "None" of "ResponseHandler | None" has no attribute "transport" [union-attr]
aiodocker/stream.py:83: error: Item "None" of "Transport | Any | None" has no attribute "get_extra_info" [union-attr]
aiodocker/stream.py:90: error: Argument 1 to "FlowControlDataQueue" has incompatible type "ResponseHandler | None"; expected "BaseProtocol" [arg-type]
aiodocker/stream.py:92: error: Item "None" of "ResponseHandler | None" has no attribute "set_parser" [union-attr]
aiodocker/stream.py:93: error: Item "None" of "ResponseHandler | None" has no attribute "force_close" [union-attr]
aiodocker/stream.py:94: error: Incompatible types in assignment (expression has type "FlowControlDataQueue[Message]", variable has type "None") [assignment]
aiodocker/stream.py:111: error: Item "None" of "Connection | None" has no attribute "transport" [union-attr]
aiodocker/stream.py:112: error: Item "None" of "Transport | Any | None" has no attribute "write" [union-attr]
aiodocker/stream.py:113: error: Item "None" of "Connection | None" has no attribute "protocol" [union-attr]
aiodocker/stream.py:114: error: Item "None" of "ResponseHandler | Any | None" has no attribute "transport" [union-attr]
aiodocker/stream.py:115: error: Item "None" of "ResponseHandler | Any | None" has no attribute "_drain_helper" [union-attr]
aiodocker/stream.py:123: error: Item "None" of "Connection | None" has no attribute "transport" [union-attr]
aiodocker/logs.py:44: error: Incompatible types in assignment (expression has type "ClientResponse", variable has type "None") [assignment]
aiodocker/docker.py:134: error: Argument "ssl" to "TCPConnector" has incompatible type "SSLContext | None"; expected "bool | Fingerprint | SSLContext" [arg-type]
Found 14 errors in 3 files (checked 39 source files)
What do these changes do?
Use
TYPE_CHECKING
flag to avoid importing fromtyping_extensions
at run timeAre there changes in behavior for the user?
typing_extensions
would no longer be importable from this package, but users shouldn't be doing that anyway :)Related issue number
https://github.com/aio-libs/aiodocker/issues/876
Checklist
CONTRIBUTORS.txt
changes
folder<issue_id>.<type>
for example (588.bug)issue_id
change it to the pr id after creating the pr.feature
: Signifying a new feature..bugfix
: Signifying a bug fix..doc
: Signifying a documentation improvement..removal
: Signifying a deprecation or removal of public API..misc
: A ticket has been closed, but it is not of interest to users.Closes https://github.com/aio-libs/aiodocker/issues/876