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)
Originally posted by @edgarrmondragon in https://github.com/aio-libs/aiodocker/issues/877#issuecomment-2233741005