Skip to content

Commit 1f6abac

Browse files
illia-vhugovk
andauthored
Bump versions of pre-commit hooks (#3716)
* Bump versions of pre-commit hooks * Apply an autofix of a zizmor warning warning[dependabot-cooldown]: insufficient cooldown in Dependabot updates --> ./.github/dependabot.yml:3:5 | 3 | - package-ecosystem: "github-actions" | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing cooldown configuration | = note: audit confidence → High = note: this finding has an auto-fix * Apply an isort change * Apply black changes * Revert bump of ESLint for now because it requires manual changes * Fix flake8 errors src/urllib3/util/request.py:231:13: F824 `nonlocal body` is unused: name is never assigned in scope src/urllib3/util/request.py:231:13: F824 `nonlocal blocksize` is unused: name is never assigned in scope * Use black-pre-commit-mirror Co-authored-by: Hugo van Kemenade <[email protected]> --------- Co-authored-by: Hugo van Kemenade <[email protected]>
1 parent 1c8fbf7 commit 1f6abac

10 files changed

Lines changed: 28 additions & 24 deletions

File tree

‎.github/dependabot.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ updates:
1212
# upgrade if we run into a bug and need a fix.
1313
- dependency-name: "*"
1414
update-types: ["version-update:semver-patch"]
15+
cooldown:
16+
default-days: 7

‎.pre-commit-config.yaml‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
11
repos:
22
- repo: https://github.com/asottile/pyupgrade
3-
rev: v3.19.0
3+
rev: v3.21.2
44
hooks:
55
- id: pyupgrade
66
args: ["--py39-plus"]
77

8-
- repo: https://github.com/psf/black
9-
rev: 24.10.0
8+
- repo: https://github.com/psf/black-pre-commit-mirror
9+
rev: 25.11.0
1010
hooks:
1111
- id: black
1212
args: ["--target-version", "py39"]
1313

1414
- repo: https://github.com/PyCQA/isort
15-
rev: 5.13.2
15+
rev: 7.0.0
1616
hooks:
1717
- id: isort
1818

1919
- repo: https://github.com/PyCQA/flake8
20-
rev: 7.1.1
20+
rev: 7.3.0
2121
hooks:
2222
- id: flake8
2323
additional_dependencies: [flake8-2020]
2424

2525
- repo: https://github.com/astral-sh/uv-pre-commit
26-
rev: 0.7.8
26+
rev: 0.9.10
2727
hooks:
2828
- id: uv-lock
2929

3030
- repo: https://github.com/zizmorcore/zizmor-pre-commit
31-
rev: v1.13.0
31+
rev: v1.16.3
3232
hooks:
3333
- id: zizmor
3434

‎dummyserver/testcase.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ def mark(cls, monkeypatch: pytest.MonkeyPatch) -> typing.Generator[None]:
314314
orig_request = HTTPConnection.request
315315

316316
def call_and_mark(
317-
target: typing.Callable[..., None]
317+
target: typing.Callable[..., None],
318318
) -> typing.Callable[..., None]:
319319
def part(
320320
self: HTTPConnection, *args: typing.Any, **kwargs: typing.Any

‎src/urllib3/util/request.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,6 @@ def body_to_chunks(
228228
elif hasattr(body, "read"):
229229

230230
def chunk_readable() -> typing.Iterable[bytes]:
231-
nonlocal body, blocksize
232231
encode = isinstance(body, io.TextIOBase)
233232
while True:
234233
datablock = body.read(blocksize)

‎test/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def wrapper(*args: typing.Any, **kwargs: typing.Any) -> typing.Any:
182182
return typing.cast(_TestFuncT, wrapper)
183183

184184
def _decorator_requires_internet(
185-
decorator: typing.Callable[[_TestFuncT], _TestFuncT]
185+
decorator: typing.Callable[[_TestFuncT], _TestFuncT],
186186
) -> typing.Callable[[_TestFuncT], _TestFuncT]:
187187
"""Mark a decorator with the "requires_internet" mark"""
188188

‎test/test_connection.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@
2323
from urllib3.util.ssl_match_hostname import (
2424
CertificateError as ImplementationCertificateError,
2525
)
26-
from urllib3.util.ssl_match_hostname import _dnsname_match, match_hostname
26+
from urllib3.util.ssl_match_hostname import (
27+
_dnsname_match,
28+
match_hostname,
29+
)
2730

2831
if typing.TYPE_CHECKING:
2932
from urllib3.util.ssl_ import _TYPE_PEER_CERT_RET_DICT

‎test/test_fields.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def test_format_header_param_html5_deprecated(self) -> None:
9393
("näme", "näme"),
9494
(b"n\xc3\xa4me", "näme"),
9595
("ski ⛷.txt", "ski ⛷.txt"),
96-
("control \x1A\x1B\x1C", "control \x1A\x1B\x1C"),
96+
("control \x1a\x1b\x1c", "control \x1a\x1b\x1c"),
9797
("backslash \\", "backslash \\"),
9898
("quotes '\"", "quotes '%22"),
9999
("newline \n\r", "newline %0A%0D"),

‎test/test_util.py‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,11 @@ def test_encode_invalid_chars_none(self) -> None:
162162
"http://google.com:65536",
163163
"http://google.com:\xb2\xb2", # \xb2 = ^2
164164
# Invalid IDNA labels
165-
"http://\uD7FF.com",
165+
"http://\ud7ff.com",
166166
"http://❤️",
167167
# Unicode surrogates
168-
"http://\uD800.com",
169-
"http://\uDC00.com",
168+
"http://\ud800.com",
169+
"http://\udc00.com",
170170
],
171171
)
172172
def test_invalid_url(self, url: str) -> None:
@@ -217,7 +217,7 @@ def test_parse_url_normalization(
217217
actual_normalized_url = parse_url(url).url
218218
assert actual_normalized_url == expected_normalized_url
219219

220-
@pytest.mark.parametrize("char", [chr(i) for i in range(0x00, 0x21)] + ["\x7F"])
220+
@pytest.mark.parametrize("char", [chr(i) for i in range(0x00, 0x21)] + ["\x7f"])
221221
def test_control_characters_are_percent_encoded(self, char: str) -> None:
222222
percent_char = "%" + (hex(ord(char))[2:].zfill(2).upper())
223223
url = parse_url(
@@ -295,13 +295,13 @@ def test_control_characters_are_percent_encoded(self, char: str) -> None:
295295
Url("http", auth="user%22:quoted", host="example.com", path="/"),
296296
),
297297
# Unicode Surrogates
298-
("http://google.com/\uD800", Url("http", host="google.com", path="%ED%A0%80")),
298+
("http://google.com/\ud800", Url("http", host="google.com", path="%ED%A0%80")),
299299
(
300-
"http://google.com?q=\uDC00",
300+
"http://google.com?q=\udc00",
301301
Url("http", host="google.com", path="", query="q=%ED%B0%80"),
302302
),
303303
(
304-
"http://google.com#\uDC00",
304+
"http://google.com#\udc00",
305305
Url("http", host="google.com", path="", fragment="%ED%B0%80"),
306306
),
307307
]
@@ -1121,6 +1121,6 @@ def teardown_class(cls) -> None:
11211121
module_stash.pop()
11221122

11231123
def test_parse_url_without_idna(self) -> None:
1124-
url = "http://\uD7FF.com"
1124+
url = "http://\ud7ff.com"
11251125
with pytest.raises(LocationParseError, match=f"Failed to parse: {url}"):
11261126
parse_url(url)

‎test/with_dummyserver/test_chunked_transfer.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def test_bytestring_body(self) -> None:
9898

9999
def test_unicode_body(self) -> None:
100100
self._test_body(
101-
"thisshouldbeonechunk\r\näöüß\xFF",
101+
"thisshouldbeonechunk\r\näöüß\xff",
102102
expected_data=b"thisshouldbeonechunk\r\n\xc3\xa4\xc3\xb6\xc3\xbc\xc3\x9f\xc3\xbf",
103103
)
104104

@@ -114,7 +114,7 @@ def test_bytes_body_fileio(self, bytes_data: bytes) -> None:
114114

115115
def test_unicode_body_fileio(self) -> None:
116116
self._test_body(
117-
io.StringIO("thisshouldbeonechunk\r\näöüß\xFF"),
117+
io.StringIO("thisshouldbeonechunk\r\näöüß\xff"),
118118
expected_data=b"thisshouldbeonechunk\r\n\xc3\xa4\xc3\xb6\xc3\xbc\xc3\x9f\xc3\xbf",
119119
)
120120

@@ -133,7 +133,7 @@ def send_body() -> typing.Iterable[bytes]:
133133

134134
def test_unicode_body_iterable(self) -> None:
135135
def send_body() -> typing.Iterable[str]:
136-
yield "thisshouldbeonechunk\r\näöüß\xFF"
136+
yield "thisshouldbeonechunk\r\näöüß\xff"
137137

138138
self._test_body(
139139
send_body(),

‎test/with_dummyserver/test_socketlevel.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2041,7 +2041,7 @@ def test_request_headers_are_sent_in_the_original_order(self) -> None:
20412041
]
20422042

20432043
def filter_non_x_headers(
2044-
d: typing.OrderedDict[str, str]
2044+
d: typing.OrderedDict[str, str],
20452045
) -> list[tuple[str, str]]:
20462046
return [(k, v) for (k, v) in d.items() if k.startswith("X-Header-")]
20472047

0 commit comments

Comments
 (0)