summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.pre-commit-config.yaml6
-rw-r--r--dummyserver/testcase.py1
-rw-r--r--src/urllib3/_collections.py1
-rw-r--r--src/urllib3/connection.py2
-rw-r--r--src/urllib3/connectionpool.py2
-rw-r--r--src/urllib3/poolmanager.py1
-rw-r--r--src/urllib3/response.py1
-rw-r--r--src/urllib3/util/ssltransport.py1
-rw-r--r--test/__init__.py7
-rw-r--r--test/test_retry.py1
-rw-r--r--test/test_ssl.py1
-rw-r--r--test/test_ssltransport.py4
-rw-r--r--test/test_util.py1
-rw-r--r--test/with_dummyserver/test_connectionpool.py1
-rw-r--r--test/with_dummyserver/test_https.py2
-rw-r--r--test/with_dummyserver/test_proxy_poolmanager.py3
-rw-r--r--test/with_dummyserver/test_socketlevel.py2
17 files changed, 6 insertions, 31 deletions
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index ecad98ff..dc05ec68 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1,12 +1,12 @@
repos:
- repo: https://github.com/asottile/pyupgrade
- rev: v2.37.3
+ rev: v3.3.1
hooks:
- id: pyupgrade
args: ["--py37-plus"]
- repo: https://github.com/psf/black
- rev: 22.6.0
+ rev: 23.1.0
hooks:
- id: black
args: ["--target-version", "py37"]
@@ -17,7 +17,7 @@ repos:
- id: isort
- repo: https://github.com/PyCQA/flake8
- rev: 5.0.2
+ rev: 6.0.0
hooks:
- id: flake8
additional_dependencies: [flake8-2020]
diff --git a/dummyserver/testcase.py b/dummyserver/testcase.py
index 8d46747f..a6811067 100644
--- a/dummyserver/testcase.py
+++ b/dummyserver/testcase.py
@@ -281,7 +281,6 @@ class IPv6HTTPDummyServerTestCase(HTTPDummyServerTestCase):
@pytest.mark.skipif(not HAS_IPV6, reason="IPv6 not available")
class IPv6HTTPDummyProxyTestCase(HTTPDummyProxyTestCase):
-
http_host = "localhost"
http_host_alt = "127.0.0.1"
diff --git a/src/urllib3/_collections.py b/src/urllib3/_collections.py
index ec81768c..3e43afbc 100644
--- a/src/urllib3/_collections.py
+++ b/src/urllib3/_collections.py
@@ -6,7 +6,6 @@ from enum import Enum, auto
from threading import RLock
if typing.TYPE_CHECKING:
-
# We can only import Protocol if TYPE_CHECKING because it's a development
# dependency, and is not available at runtime.
from typing_extensions import Protocol
diff --git a/src/urllib3/connection.py b/src/urllib3/connection.py
index 2873251d..1f13af0b 100644
--- a/src/urllib3/connection.py
+++ b/src/urllib3/connection.py
@@ -321,7 +321,6 @@ class HTTPConnection(_HTTPConnection):
decode_content: bool = True,
enforce_content_length: bool = True,
) -> None:
-
# Update the inner socket's timeout value to send the request.
# This only triggers if the connection is re-used.
if self.sock is not None:
@@ -526,7 +525,6 @@ class HTTPSConnection(HTTPConnection):
key_file: str | None = None,
key_password: str | None = None,
) -> None:
-
super().__init__(
host,
port=port,
diff --git a/src/urllib3/connectionpool.py b/src/urllib3/connectionpool.py
index 7dfb846e..2479405b 100644
--- a/src/urllib3/connectionpool.py
+++ b/src/urllib3/connectionpool.py
@@ -316,7 +316,6 @@ class HTTPConnectionPool(ConnectionPool, RequestMethods):
# self.pool is None.
pass
except queue.Full:
-
# Connection never got put back into the pool, close it.
if conn:
conn.close()
@@ -1001,7 +1000,6 @@ class HTTPSConnectionPool(HTTPConnectionPool):
ca_cert_dir: str | None = None,
**conn_kw: typing.Any,
) -> None:
-
super().__init__(
host,
port,
diff --git a/src/urllib3/poolmanager.py b/src/urllib3/poolmanager.py
index 538bed3c..b8434a32 100644
--- a/src/urllib3/poolmanager.py
+++ b/src/urllib3/poolmanager.py
@@ -543,7 +543,6 @@ class ProxyManager(PoolManager):
proxy_assert_fingerprint: str | None = None,
**connection_pool_kw: typing.Any,
) -> None:
-
if isinstance(proxy_url, HTTPConnectionPool):
str_proxy_url = f"{proxy_url.scheme}://{proxy_url.host}:{proxy_url.port}"
else:
diff --git a/src/urllib3/response.py b/src/urllib3/response.py
index d21ad4fd..69e1bd66 100644
--- a/src/urllib3/response.py
+++ b/src/urllib3/response.py
@@ -106,7 +106,6 @@ class DeflateDecoder(ContentDecoder):
class GzipDecoderState:
-
FIRST_MEMBER = 0
OTHER_MEMBERS = 1
SWALLOW_DATA = 2
diff --git a/src/urllib3/util/ssltransport.py b/src/urllib3/util/ssltransport.py
index 5f5fcf68..5ec86473 100644
--- a/src/urllib3/util/ssltransport.py
+++ b/src/urllib3/util/ssltransport.py
@@ -8,7 +8,6 @@ import typing
from ..exceptions import ProxySchemeUnsupported
if typing.TYPE_CHECKING:
-
from typing_extensions import Literal
from .ssl_ import _TYPE_PEER_CERT_RET, _TYPE_PEER_CERT_RET_DICT
diff --git a/test/__init__.py b/test/__init__.py
index df1d7aed..f241d3c7 100644
--- a/test/__init__.py
+++ b/test/__init__.py
@@ -218,9 +218,9 @@ def requires_network() -> typing.Callable[[_TestFuncT], _TestFuncT]:
)
-def requires_ssl_context_keyfile_password() -> typing.Callable[
- [_TestFuncT], _TestFuncT
-]:
+def requires_ssl_context_keyfile_password() -> (
+ typing.Callable[[_TestFuncT], _TestFuncT]
+):
return pytest.mark.skipif(
lazy_condition(lambda: ssl_.IS_SECURETRANSPORT),
reason="Test requires password parameter for SSLContext.load_cert_chain()",
@@ -324,7 +324,6 @@ class ImportBlocker(MetaPathFinder):
path: Sequence[bytes | str] | None,
target: ModuleType | None = None,
) -> ModuleSpec | None:
-
loader = self.find_module(fullname, path)
if loader is None:
return None
diff --git a/test/test_retry.py b/test/test_retry.py
index d2774f41..72a32e00 100644
--- a/test/test_retry.py
+++ b/test/test_retry.py
@@ -328,7 +328,6 @@ class TestRetry:
def test_respect_retry_after_header_propagated(
self, respect_retry_after_header: bool
) -> None:
-
retry = Retry(respect_retry_after_header=respect_retry_after_header)
new_retry = retry.new()
assert new_retry.respect_retry_after_header == respect_retry_after_header
diff --git a/test/test_ssl.py b/test/test_ssl.py
index 6ea91e16..0d12c428 100644
--- a/test/test_ssl.py
+++ b/test/test_ssl.py
@@ -47,7 +47,6 @@ class TestSSL:
def test_create_urllib3_context_set_ciphers(
self, monkeypatch: pytest.MonkeyPatch
) -> None:
-
ciphers = "ECDH+AESGCM:ECDH+CHACHA20"
context = mock.create_autospec(ssl_.SSLContext)
context.set_ciphers = mock.Mock()
diff --git a/test/test_ssltransport.py b/test/test_ssltransport.py
index 8cc11301..72f5cbb8 100644
--- a/test/test_ssltransport.py
+++ b/test/test_ssltransport.py
@@ -90,7 +90,6 @@ def validate_response(
def validate_peercert(ssl_socket: SSLTransport) -> None:
-
binary_cert = ssl_socket.getpeercert(binary_form=True)
assert type(binary_cert) == bytes
assert len(binary_cert) > 0
@@ -440,7 +439,6 @@ class TlsInTlsTestCase(SocketDummyServerTestCase):
with SSLTransport(
proxy_sock, self.client_context, server_hostname="localhost"
) as destination_sock:
-
file = destination_sock.makefile("rwb", buffering)
file.write(sample_request()) # type: ignore[arg-type]
file.flush()
@@ -476,7 +474,6 @@ class TlsInTlsTestCase(SocketDummyServerTestCase):
with SSLTransport(
proxy_sock, self.client_context, server_hostname="localhost"
) as destination_sock:
-
read = destination_sock.makefile("r", encoding="utf-8")
write = destination_sock.makefile("w", encoding="utf-8")
@@ -510,7 +507,6 @@ class TlsInTlsTestCase(SocketDummyServerTestCase):
with SSLTransport(
proxy_sock, self.client_context, server_hostname="localhost"
) as destination_sock:
-
destination_sock.sendall(sample_request())
response = bytearray(65536)
destination_sock.recv_into(response)
diff --git a/test/test_util.py b/test/test_util.py
index 84b5e8da..38f27129 100644
--- a/test/test_util.py
+++ b/test/test_util.py
@@ -51,7 +51,6 @@ TIMEOUT_EPOCH = 1000
class TestUtil:
-
url_host_map = [
# Hosts
("http://google.com/mail", ("http", "google.com", None)),
diff --git a/test/with_dummyserver/test_connectionpool.py b/test/with_dummyserver/test_connectionpool.py
index 13ad811d..1748fbda 100644
--- a/test/with_dummyserver/test_connectionpool.py
+++ b/test/with_dummyserver/test_connectionpool.py
@@ -1060,7 +1060,6 @@ class TestConnectionPool(HTTPDummyServerTestCase):
def test_request_chunked_is_deprecated(
self,
) -> None:
-
with HTTPConnectionPool(self.host, self.port) as pool:
conn = pool._get_conn()
diff --git a/test/with_dummyserver/test_https.py b/test/with_dummyserver/test_https.py
index 7678bfbe..40948f80 100644
--- a/test/with_dummyserver/test_https.py
+++ b/test/with_dummyserver/test_https.py
@@ -508,7 +508,6 @@ class TestHTTPS(HTTPSDummyServerTestCase):
ca_certs=DEFAULT_CA,
ssl_minimum_version=self.tls_version(),
) as https_pool:
-
https_pool.assert_fingerprint = (
"AA:AA:AA:AA:AA:AAAA:AA:AAAA:AA:AA:AA:AA:AA:AA:AA:AA:AA:AA"
)
@@ -574,7 +573,6 @@ class TestHTTPS(HTTPSDummyServerTestCase):
@requires_network()
def test_https_timeout(self) -> None:
-
timeout = Timeout(total=None, connect=SHORT_TIMEOUT)
with HTTPSConnectionPool(
TARPIT_HOST,
diff --git a/test/with_dummyserver/test_proxy_poolmanager.py b/test/with_dummyserver/test_proxy_poolmanager.py
index 171cb23b..699467f2 100644
--- a/test/with_dummyserver/test_proxy_poolmanager.py
+++ b/test/with_dummyserver/test_proxy_poolmanager.py
@@ -277,7 +277,6 @@ class TestHTTPProxyManager(HTTPDummyProxyTestCase):
proxy_headers={"Hickory": "dickory"},
ca_certs=DEFAULT_CA,
) as http:
-
r = http.request_encode_url("GET", f"{self.http_url}/headers")
returned_headers = r.json()
assert returned_headers.get("Foo") == "bar"
@@ -353,7 +352,6 @@ class TestHTTPProxyManager(HTTPDummyProxyTestCase):
proxy_headers={"Hickory": "dickory"},
ca_certs=DEFAULT_CA,
) as http:
-
r = http.request_encode_url("GET", f"{self.http_url}/headers")
returned_headers = r.json()
assert returned_headers.get("Foo") == "bar"
@@ -387,7 +385,6 @@ class TestHTTPProxyManager(HTTPDummyProxyTestCase):
ca_certs=DEFAULT_CA,
use_forwarding_for_https=True,
) as http:
-
r = http.request_encode_url("GET", f"{self.https_url}/headers")
returned_headers = r.json()
assert returned_headers.get("Foo") == "bar"
diff --git a/test/with_dummyserver/test_socketlevel.py b/test/with_dummyserver/test_socketlevel.py
index d8f70a7d..0a6a8ae3 100644
--- a/test/with_dummyserver/test_socketlevel.py
+++ b/test/with_dummyserver/test_socketlevel.py
@@ -1197,7 +1197,6 @@ class TestProxyManager(SocketDummyServerTestCase):
def test_https_proxymanager_connected_to_http_proxy(
self, target_scheme: str
) -> None:
-
errored = Event()
def http_socket_handler(listener: socket.socket) -> None:
@@ -1484,7 +1483,6 @@ class TestSSL(SocketDummyServerTestCase):
{"ca_certs": "a", "ca_cert_dir": "a"},
{"ssl_context": context},
]:
-
self._start_server(socket_handler)
with HTTPSConnectionPool(self.host, self.port, **kwargs) as pool: