From 8bf5d4d493f56958eff1a7542ec6449388735d8b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 4 Feb 2025 19:54:08 -0600 Subject: [PATCH] [pre-commit.ci] pre-commit autoupdate (#10376) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 6 +++--- tests/test_client_session.py | 22 +++++++++++----------- tests/test_cookiejar.py | 2 +- tests/test_http_parser.py | 16 ++++++++-------- tests/test_proxy_functional.py | 24 ++++++++++++------------ 5 files changed, 35 insertions(+), 35 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5463b83d19e..fc45948a618 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -56,11 +56,11 @@ repos: hooks: - id: yesqa - repo: https://github.com/PyCQA/isort - rev: '5.13.2' + rev: '6.0.0' hooks: - id: isort - repo: https://github.com/psf/black - rev: '24.10.0' + rev: '25.1.0' hooks: - id: black language_version: python3 # Should be a command that runs python @@ -119,7 +119,7 @@ repos: exclude: >- ^CHANGES\.rst$ - repo: https://github.com/codespell-project/codespell - rev: v2.4.0 + rev: v2.4.1 hooks: - id: codespell additional_dependencies: diff --git a/tests/test_client_session.py b/tests/test_client_session.py index 20f401020a4..41ba0ac4fe1 100644 --- a/tests/test_client_session.py +++ b/tests/test_client_session.py @@ -98,21 +98,21 @@ def params() -> _Params: async def test_close_coro( - create_session: Callable[..., Awaitable[ClientSession]] + create_session: Callable[..., Awaitable[ClientSession]], ) -> None: session = await create_session() await session.close() async def test_init_headers_simple_dict( - create_session: Callable[..., Awaitable[ClientSession]] + create_session: Callable[..., Awaitable[ClientSession]], ) -> None: session = await create_session(headers={"h1": "header1", "h2": "header2"}) assert sorted(session.headers.items()) == ([("h1", "header1"), ("h2", "header2")]) async def test_init_headers_list_of_tuples( - create_session: Callable[..., Awaitable[ClientSession]] + create_session: Callable[..., Awaitable[ClientSession]], ) -> None: session = await create_session( headers=[("h1", "header1"), ("h2", "header2"), ("h3", "header3")] @@ -123,7 +123,7 @@ async def test_init_headers_list_of_tuples( async def test_init_headers_MultiDict( - create_session: Callable[..., Awaitable[ClientSession]] + create_session: Callable[..., Awaitable[ClientSession]], ) -> None: session = await create_session( headers=MultiDict([("h1", "header1"), ("h2", "header2"), ("h3", "header3")]) @@ -134,7 +134,7 @@ async def test_init_headers_MultiDict( async def test_init_headers_list_of_tuples_with_duplicates( - create_session: Callable[..., Awaitable[ClientSession]] + create_session: Callable[..., Awaitable[ClientSession]], ) -> None: session = await create_session( headers=[("h1", "header11"), ("h2", "header21"), ("h1", "header12")] @@ -145,7 +145,7 @@ async def test_init_headers_list_of_tuples_with_duplicates( async def test_init_cookies_with_simple_dict( - create_session: Callable[..., Awaitable[ClientSession]] + create_session: Callable[..., Awaitable[ClientSession]], ) -> None: session = await create_session(cookies={"c1": "cookie1", "c2": "cookie2"}) cookies = session.cookie_jar.filter_cookies(URL()) @@ -155,7 +155,7 @@ async def test_init_cookies_with_simple_dict( async def test_init_cookies_with_list_of_tuples( - create_session: Callable[..., Awaitable[ClientSession]] + create_session: Callable[..., Awaitable[ClientSession]], ) -> None: session = await create_session(cookies=[("c1", "cookie1"), ("c2", "cookie2")]) @@ -166,7 +166,7 @@ async def test_init_cookies_with_list_of_tuples( async def test_merge_headers( - create_session: Callable[..., Awaitable[ClientSession]] + create_session: Callable[..., Awaitable[ClientSession]], ) -> None: # Check incoming simple dict session = await create_session(headers={"h1": "header1", "h2": "header2"}) @@ -177,7 +177,7 @@ async def test_merge_headers( async def test_merge_headers_with_multi_dict( - create_session: Callable[..., Awaitable[ClientSession]] + create_session: Callable[..., Awaitable[ClientSession]], ) -> None: session = await create_session(headers={"h1": "header1", "h2": "header2"}) headers = session._prepare_headers(MultiDict([("h1", "h1")])) @@ -186,7 +186,7 @@ async def test_merge_headers_with_multi_dict( async def test_merge_headers_with_list_of_tuples( - create_session: Callable[..., Awaitable[ClientSession]] + create_session: Callable[..., Awaitable[ClientSession]], ) -> None: session = await create_session(headers={"h1": "header1", "h2": "header2"}) headers = session._prepare_headers([("h1", "h1")]) @@ -1049,7 +1049,7 @@ async def test_client_session_timeout_default_args( async def test_client_session_timeout_zero( - create_mocked_conn: Callable[[], ResponseHandler] + create_mocked_conn: Callable[[], ResponseHandler], ) -> None: async def create_connection( req: object, traces: object, timeout: object diff --git a/tests/test_cookiejar.py b/tests/test_cookiejar.py index 8bf1ecde8cf..ce125946823 100644 --- a/tests/test_cookiejar.py +++ b/tests/test_cookiejar.py @@ -1129,7 +1129,7 @@ def test_pickle_format(cookies_to_send: SimpleCookie) -> None: ], ) async def test_treat_as_secure_origin_init( - url: Union[str, URL, List[str], List[URL]] + url: Union[str, URL, List[str], List[URL]], ) -> None: jar = CookieJar(unsafe=True, treat_as_secure_origin=url) assert jar._treat_as_secure_origin == frozenset({URL("http://127.0.0.1")}) diff --git a/tests/test_http_parser.py b/tests/test_http_parser.py index f7489bc7656..b67f225b55e 100644 --- a/tests/test_http_parser.py +++ b/tests/test_http_parser.py @@ -214,8 +214,8 @@ def test_bad_header_name( ( "Content-Length: -5", # https://www.rfc-editor.org/rfc/rfc9110.html#name-content-length "Content-Length: +256", - "Content-Length: \N{superscript one}", - "Content-Length: \N{mathematical double-struck digit one}", + "Content-Length: \N{SUPERSCRIPT ONE}", + "Content-Length: \N{MATHEMATICAL DOUBLE-STRUCK DIGIT ONE}", "Foo: abc\rdef", # https://www.rfc-editor.org/rfc/rfc9110.html#section-5.5-5 "Bar: abc\ndef", "Baz: abc\x00def", @@ -820,11 +820,11 @@ def test_http_request_bad_status_line(parser: HttpRequestParser) -> None: _num: Dict[bytes, str] = { # dangerous: accepted by Python int() # unicodedata.category("\U0001D7D9") == 'Nd' - "\N{mathematical double-struck digit one}".encode(): "utf8digit", + "\N{MATHEMATICAL DOUBLE-STRUCK DIGIT ONE}".encode(): "utf8digit", # only added for interop tests, refused by Python int() # unicodedata.category("\U000000B9") == 'No' - "\N{superscript one}".encode(): "utf8number", - "\N{superscript one}".encode("latin-1"): "latin1number", + "\N{SUPERSCRIPT ONE}".encode(): "utf8number", + "\N{SUPERSCRIPT ONE}".encode("latin-1"): "latin1number", } @@ -839,7 +839,7 @@ def test_http_request_bad_status_line_number( def test_http_request_bad_status_line_separator(parser: HttpRequestParser) -> None: # single code point, old, multibyte NFKC, multibyte NFKD - utf8sep = "\N{arabic ligature sallallahou alayhe wasallam}".encode() + utf8sep = "\N{ARABIC LIGATURE SALLALLAHOU ALAYHE WASALLAM}".encode() text = b"GET /ligature HTTP/1" + utf8sep + b"1\r\n\r\n" with pytest.raises(http_exceptions.BadStatusLine): parser.feed_data(text) @@ -913,7 +913,7 @@ def test_http_request_parser_utf8_request_line(parser: HttpRequestParser) -> Non b"GET /P\xc3\xbcnktchen\xa0\xef\xb7 HTTP/1.1\r\n" + # for easier grep: ASCII 0xA0 more commonly known as non-breaking space # note the leading and trailing spaces - "sTeP: \N{latin small letter sharp s}nek\t\N{no-break space} " + "sTeP: \N{LATIN SMALL LETTER SHARP S}nek\t\N{NO-BREAK SPACE} " "\r\n\r\n".encode() ) msg = messages[0][0] @@ -1673,7 +1673,7 @@ async def test_parse_eof_payload(self, protocol: BaseProtocol) -> None: p.feed_eof() assert out.is_eof() - assert [(bytearray(b"data"))] == list(out._buffer) + assert [bytearray(b"data")] == list(out._buffer) async def test_parse_length_payload_eof(self, protocol: BaseProtocol) -> None: out = aiohttp.StreamReader(protocol, 2**16, loop=asyncio.get_running_loop()) diff --git a/tests/test_proxy_functional.py b/tests/test_proxy_functional.py index 3f2e4a26b48..256bff1f030 100644 --- a/tests/test_proxy_functional.py +++ b/tests/test_proxy_functional.py @@ -292,7 +292,7 @@ async def proxy_server() -> mock.Mock: async def test_proxy_http_absolute_path( - proxy_test_server: Callable[[], Awaitable[mock.Mock]] + proxy_test_server: Callable[[], Awaitable[mock.Mock]], ) -> None: url = "http://aiohttp.io/path?query=yes" proxy = await proxy_test_server() @@ -306,7 +306,7 @@ async def test_proxy_http_absolute_path( async def test_proxy_http_raw_path( - proxy_test_server: Callable[[], Awaitable[mock.Mock]] + proxy_test_server: Callable[[], Awaitable[mock.Mock]], ) -> None: url = "http://aiohttp.io:2561/space sheep?q=can:fly" raw_url = "/space%20sheep?q=can:fly" @@ -319,7 +319,7 @@ async def test_proxy_http_raw_path( async def test_proxy_http_idna_support( - proxy_test_server: Callable[[], Awaitable[mock.Mock]] + proxy_test_server: Callable[[], Awaitable[mock.Mock]], ) -> None: url = "http://éé.com/" proxy = await proxy_test_server() @@ -339,7 +339,7 @@ async def test_proxy_http_connection_error() -> None: async def test_proxy_http_bad_response( - proxy_test_server: Callable[[], Awaitable[mock.Mock]] + proxy_test_server: Callable[[], Awaitable[mock.Mock]], ) -> None: url = "http://aiohttp.io/path" proxy = await proxy_test_server() @@ -352,7 +352,7 @@ async def test_proxy_http_bad_response( async def test_proxy_http_auth( - proxy_test_server: Callable[[], Awaitable[mock.Mock]] + proxy_test_server: Callable[[], Awaitable[mock.Mock]], ) -> None: url = "http://aiohttp.io/path" proxy = await proxy_test_server() @@ -380,7 +380,7 @@ async def test_proxy_http_auth( async def test_proxy_http_auth_utf8( - proxy_test_server: Callable[[], Awaitable[mock.Mock]] + proxy_test_server: Callable[[], Awaitable[mock.Mock]], ) -> None: url = "http://aiohttp.io/path" auth = aiohttp.BasicAuth("юзер", "пасс", "utf-8") @@ -393,7 +393,7 @@ async def test_proxy_http_auth_utf8( async def test_proxy_http_auth_from_url( - proxy_test_server: Callable[[], Awaitable[mock.Mock]] + proxy_test_server: Callable[[], Awaitable[mock.Mock]], ) -> None: url = "http://aiohttp.io/path" proxy = await proxy_test_server() @@ -492,7 +492,7 @@ async def request(pid: int) -> ClientResponse: @pytest.mark.xfail async def test_proxy_https_connect( - proxy_test_server: Callable[[], Awaitable[mock.Mock]] + proxy_test_server: Callable[[], Awaitable[mock.Mock]], ) -> None: proxy = await proxy_test_server() url = "https://www.google.com.ua/search?q=aiohttp proxy" @@ -510,7 +510,7 @@ async def test_proxy_https_connect( @pytest.mark.xfail async def test_proxy_https_connect_with_port( - proxy_test_server: Callable[[], Awaitable[mock.Mock]] + proxy_test_server: Callable[[], Awaitable[mock.Mock]], ) -> None: proxy = await proxy_test_server() url = "https://secure.aiohttp.io:2242/path" @@ -545,7 +545,7 @@ async def test_proxy_https_send_body( @pytest.mark.xfail async def test_proxy_https_idna_support( - proxy_test_server: Callable[[], Awaitable[mock.Mock]] + proxy_test_server: Callable[[], Awaitable[mock.Mock]], ) -> None: url = "https://éé.com/" proxy = await proxy_test_server() @@ -567,7 +567,7 @@ async def test_proxy_https_connection_error() -> None: async def test_proxy_https_bad_response( - proxy_test_server: Callable[[], Awaitable[mock.Mock]] + proxy_test_server: Callable[[], Awaitable[mock.Mock]], ) -> None: url = "https://secure.aiohttp.io/path" proxy = await proxy_test_server() @@ -584,7 +584,7 @@ async def test_proxy_https_bad_response( @pytest.mark.xfail async def test_proxy_https_auth( - proxy_test_server: Callable[[], Awaitable[mock.Mock]] + proxy_test_server: Callable[[], Awaitable[mock.Mock]], ) -> None: url = "https://secure.aiohttp.io/path" auth = aiohttp.BasicAuth("user", "pass")