From: T-256 <132141463+T-256@users.noreply.github.com> Date: Fri, 1 Mar 2024 19:49:23 +0000 (+0330) Subject: format (#3131) X-Git-Tag: 0.27.1~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0006ed0547f8f8a3cbe2edf758e996c3c73b5e7d;p=thirdparty%2Fhttpx.git format (#3131) Co-authored-by: T-256 --- diff --git a/httpx/_compat.py b/httpx/_compat.py index 493e6210..27ccc682 100644 --- a/httpx/_compat.py +++ b/httpx/_compat.py @@ -2,6 +2,7 @@ The _compat module is used for code which requires branching between different Python environments. It is excluded from the code coverage checks. """ + import ssl import sys diff --git a/httpx/_decoders.py b/httpx/_decoders.py index 31c72c7f..f9d3adbb 100644 --- a/httpx/_decoders.py +++ b/httpx/_decoders.py @@ -3,6 +3,7 @@ Handlers for Content-Encoding. See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding """ + from __future__ import annotations import codecs diff --git a/httpx/_exceptions.py b/httpx/_exceptions.py index 18dfa2f2..77f45a6d 100644 --- a/httpx/_exceptions.py +++ b/httpx/_exceptions.py @@ -30,6 +30,7 @@ Our exception hierarchy: x ResponseNotRead x RequestNotRead """ + from __future__ import annotations import contextlib diff --git a/httpx/_transports/default.py b/httpx/_transports/default.py index e82104e9..bcc8bf42 100644 --- a/httpx/_transports/default.py +++ b/httpx/_transports/default.py @@ -23,6 +23,7 @@ client = httpx.Client(transport=transport) transport = httpx.HTTPTransport(uds="socket.uds") client = httpx.Client(transport=transport) """ + from __future__ import annotations import contextlib diff --git a/httpx/_urlparse.py b/httpx/_urlparse.py index 6a4b55b3..232269ee 100644 --- a/httpx/_urlparse.py +++ b/httpx/_urlparse.py @@ -15,6 +15,7 @@ Previously we relied on the excellent `rfc3986` package to handle URL parsing an validation, but this module provides a simpler alternative, with less indirection required. """ + from __future__ import annotations import ipaddress diff --git a/pyproject.toml b/pyproject.toml index 3fe24a14..9e6464c2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -93,12 +93,11 @@ text = "\n---\n\n[Full changelog](https://github.com/encode/httpx/blob/master/CH pattern = 'src="(docs/img/.*?)"' replacement = 'src="https://raw.githubusercontent.com/encode/httpx/master/\1"' -# https://beta.ruff.rs/docs/configuration/#using-rufftoml -[tool.ruff] +[tool.ruff.lint] select = ["E", "F", "I", "B", "PIE"] ignore = ["B904", "B028"] -[tool.ruff.isort] +[tool.ruff.lint.isort] combine-as-imports = true [tool.ruff.lint.per-file-ignores] diff --git a/tests/client/test_auth.py b/tests/client/test_auth.py index e6bac23d..5776fc33 100644 --- a/tests/client/test_auth.py +++ b/tests/client/test_auth.py @@ -3,6 +3,7 @@ Integration tests for authentication. Unit tests for auth classes also exist in tests/test_auth.py """ + import hashlib import netrc import os diff --git a/tests/test_auth.py b/tests/test_auth.py index 7bb45de5..6b6df922 100644 --- a/tests/test_auth.py +++ b/tests/test_auth.py @@ -3,6 +3,7 @@ Unit tests for auth classes. Integration tests also exist in tests/client/test_auth.py """ + from urllib.request import parse_keqv_list import pytest diff --git a/tests/test_multipart.py b/tests/test_multipart.py index 5c462915..764f85a2 100644 --- a/tests/test_multipart.py +++ b/tests/test_multipart.py @@ -462,8 +462,8 @@ class TestHeaderParamHTML5Formatting: assert expected in request.read() def test_unicode_with_control_character(self): - filename = "hello\x1A\x1B\x1C" - expected = b'filename="hello%1A\x1B%1C"' + filename = "hello\x1a\x1b\x1c" + expected = b'filename="hello%1A\x1b%1C"' files = {"upload": (filename, b"")} request = httpx.Request("GET", "https://www.example.com", files=files) assert expected in request.read()