From 190035645418c71483daf58b14eda8e0eb0d99d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D0=B0=D0=BA=D1=8B=D1=82=20=D0=9D=D0=B8=D1=8F=D0=B7?= =?UTF-8?q?=D0=B0=D0=BB=D0=B8=D0=B5=D0=B2?= Date: Wed, 11 Jun 2025 22:46:51 +0700 Subject: [PATCH] style: format code --- python/httpx/_exceptions.py | 4 +--- python/httpx/_httpx/urlparse.pyi | 3 --- python/httpx/_urls.py | 2 +- tests/test_content.py | 12 ++++++------ 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/python/httpx/_exceptions.py b/python/httpx/_exceptions.py index 77f45a6d..dd7fb6cd 100644 --- a/python/httpx/_exceptions.py +++ b/python/httpx/_exceptions.py @@ -331,9 +331,7 @@ class StreamClosed(StreamError): """ def __init__(self) -> None: - message = ( - "Attempted to read or stream content, but the stream has " "been closed." - ) + message = "Attempted to read or stream content, but the stream has been closed." super().__init__(message) diff --git a/python/httpx/_httpx/urlparse.pyi b/python/httpx/_httpx/urlparse.pyi index a3c8603e..3c9f5e12 100644 --- a/python/httpx/_httpx/urlparse.pyi +++ b/python/httpx/_httpx/urlparse.pyi @@ -9,12 +9,9 @@ class ParseResult: @property def authority(self) -> str: ... - @property def netloc(self) -> str: ... - def __str__(self) -> str: ... - def __new__( cls, scheme: str, diff --git a/python/httpx/_urls.py b/python/httpx/_urls.py index 147a8fa3..301d0874 100644 --- a/python/httpx/_urls.py +++ b/python/httpx/_urls.py @@ -379,7 +379,7 @@ class URL: if ":" in userinfo: # Mask any password component. - userinfo = f'{userinfo.split(":")[0]}:[secure]' + userinfo = f"{userinfo.split(':')[0]}:[secure]" authority = "".join( [ diff --git a/tests/test_content.py b/tests/test_content.py index f63ec18a..9bfe9837 100644 --- a/tests/test_content.py +++ b/tests/test_content.py @@ -489,18 +489,18 @@ def test_response_invalid_argument(): def test_ensure_ascii_false_with_french_characters(): data = {"greeting": "Bonjour, ça va ?"} response = httpx.Response(200, json=data) - assert ( - "ça va" in response.text - ), "ensure_ascii=False should preserve French accented characters" + assert "ça va" in response.text, ( + "ensure_ascii=False should preserve French accented characters" + ) assert response.headers["Content-Type"] == "application/json" def test_separators_for_compact_json(): data = {"clé": "valeur", "liste": [1, 2, 3]} response = httpx.Response(200, json=data) - assert ( - response.text == '{"clé":"valeur","liste":[1,2,3]}' - ), "separators=(',', ':') should produce a compact representation" + assert response.text == '{"clé":"valeur","liste":[1,2,3]}', ( + "separators=(',', ':') should produce a compact representation" + ) assert response.headers["Content-Type"] == "application/json"