Update mypy to 0.990
MODIFY
mypy-requirements.txt
mypy-requirements.txt
-mypy==0.981
+mypy==0.990
idna>=2.0.0
cryptography>=1.3.4
tornado>=6.1

MODIFY
src/urllib3/connection.py
src/urllib3/connection.py
@@ -189,7 +189,7 @@ class HTTPConnection(_HTTPConnection):
# If `host` is made a property it violates LSP, because a writeable attribute is overridden with a read-only one.
# However, there is also a `host` setter so LSP is not violated.
# Potentially, a `@host.deleter` might be needed depending on how this issue will be fixed.
- @property # type: ignore[override]
+ @property
def host(self) -> str:
"""
Getter method to remove any trailing dots that indicate the hostname is an FQDN.

MODIFY
src/urllib3/connectionpool.py
src/urllib3/connectionpool.py
@@ -1065,7 +1065,7 @@ class HTTPSConnectionPool(HTTPConnectionPool):
self.port or "443",
)
- if not self.ConnectionCls or self.ConnectionCls is DummyConnection: # type: ignore[comparison-overlap]
+ if not self.ConnectionCls or self.ConnectionCls is DummyConnection: # type: ignore[comparison-overlap, truthy-function]
raise ImportError(
"Can't connect to HTTPS URL because the SSL module is not available."
)

MODIFY
src/urllib3/util/ssl_.py
src/urllib3/util/ssl_.py
@@ -99,7 +99,7 @@ _SSL_VERSION_TO_TLS_VERSION: Dict[int, int] = {}
try: # Do we have ssl at all?
import ssl
- from ssl import ( # type: ignore[misc]
+ from ssl import ( # type: ignore[assignment]
CERT_REQUIRED,
HAS_NEVER_CHECK_COMMON_NAME,
OP_NO_COMPRESSION,
@@ -136,7 +136,7 @@ try: # Do we have ssl at all?
except AttributeError: # Defensive:
continue
- from .ssltransport import SSLTransport # type: ignore[misc]
+ from .ssltransport import SSLTransport # type: ignore[assignment]
except ImportError:
OP_NO_COMPRESSION = 0x20000 # type: ignore[assignment]
OP_NO_TICKET = 0x4000 # type: ignore[assignment]

MODIFY
test/with_dummyserver/test_https.py
test/with_dummyserver/test_https.py
@@ -460,7 +460,7 @@ class TestHTTPS(HTTPSDummyServerTestCase):
# socket, so only add this assertion if the attribute is there (i.e.
# the python ssl module).
if hasattr(conn.sock, "server_hostname"):
- assert conn.sock.server_hostname == "localhost" # type: ignore[union-attr]
+ assert conn.sock.server_hostname == "localhost"
def test_assert_fingerprint_md5(self) -> None:
with HTTPSConnectionPool(
@@ -781,7 +781,7 @@ class TestHTTPS(HTTPSDummyServerTestCase):
conn.connect()
if not hasattr(conn.sock, "version"):
pytest.skip("SSLSocket.version() not available")
- assert conn.sock.version() == self.tls_protocol_name # type: ignore[union-attr]
+ assert conn.sock.version() == self.tls_protocol_name
finally:
conn.close()

Update mypy to 0.990