Skip to content

Commit 272979a

Browse files
TesterTester
Tester
authored and
Tester
committed
Ruff linter: Use the default line-length
1 parent 7b04cda commit 272979a

13 files changed

+177
-122
lines changed

httpcore/_async/connection.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ def __init__(
6767
async def handle_async_request(self, request: Request) -> Response:
6868
if not self.can_handle_request(request.url.origin):
6969
raise RuntimeError(
70-
f"Attempted to send request to {request.url.origin} on connection to {self._origin}"
70+
f"Attempted to send request to {request.url.origin}"
71+
f" on connection to {self._origin}"
7172
)
7273

7374
try:

httpcore/_async/connection_pool.py

+11-7
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,10 @@ def __init__(
119119
self._connections: List[AsyncConnectionInterface] = []
120120
self._requests: List[AsyncPoolRequest] = []
121121

122-
# We only mutate the state of the connection pool within an 'optional_thread_lock'
123-
# context. This holds a threading lock unless we're running in async mode,
124-
# in which case it is a no-op.
122+
# We only mutate the state of the connection pool
123+
# within an 'optional_thread_lock' context.
124+
# This holds a threading lock unless we're running in
125+
# async mode, in which case it is a no-op.
125126
self._optional_thread_lock = AsyncThreadLock()
126127

127128
def create_connection(self, origin: Origin) -> AsyncConnectionInterface:
@@ -148,9 +149,12 @@ def connections(self) -> List[AsyncConnectionInterface]:
148149
```python
149150
>>> pool.connections
150151
[
151-
<AsyncHTTPConnection ['https://example.com:443', HTTP/1.1, ACTIVE, Request Count: 6]>,
152-
<AsyncHTTPConnection ['https://example.com:443', HTTP/1.1, IDLE, Request Count: 9]> ,
153-
<AsyncHTTPConnection ['http://example.com:80', HTTP/1.1, IDLE, Request Count: 1]>,
152+
<AsyncHTTPConnection ['https://example.com:443', HTTP/1.1, ACTIVE,
153+
Request Count: 6]>,
154+
<AsyncHTTPConnection ['https://example.com:443', HTTP/1.1, IDLE,
155+
Request Count: 9]>,
156+
<AsyncHTTPConnection ['http://example.com:80', HTTP/1.1, IDLE,
157+
Request Count: 1]>,
154158
]
155159
```
156160
"""
@@ -160,7 +164,7 @@ async def handle_async_request(self, request: Request) -> Response:
160164
"""
161165
Send an HTTP request, and return an HTTP response.
162166
163-
This is the core implementation that is called into by `.request()` or `.stream()`.
167+
The core implementation that is called into by `.request()` or `.stream()`.
164168
"""
165169
scheme = request.url.scheme.decode()
166170
if scheme == "":

httpcore/_async/http2.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -470,10 +470,10 @@ async def _write_outgoing_data(self, request: Request) -> None:
470470
except Exception as exc: # pragma: nocover
471471
# If we get a network error we should:
472472
#
473-
# 1. Save the exception and just raise it immediately on any future write.
474-
# (For example, this means that a single write timeout or disconnect will
475-
# immediately close all pending streams. Without requiring multiple
476-
# sequential timeouts.)
473+
# 1. Save the exception and just raise it immediately on any
474+
# future write. (For example, this means that a single write timeout
475+
# or disconnect will immediately close all pending streams,
476+
# without requiring multiple sequential timeouts.)
477477
# 2. Mark the connection as errored, so that we don't accept any other
478478
# incoming requests.
479479
self._write_exception = exc

httpcore/_async/http_proxy.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ def __init__(
8989
ssl_context: An SSL context to use for verifying connections.
9090
If not specified, the default `httpcore.default_ssl_context()`
9191
will be used.
92-
proxy_ssl_context: The same as `ssl_context`, but for a proxy server rather than a remote origin.
92+
proxy_ssl_context: The same as `ssl_context`, but for a proxy server
93+
rather than a remote origin.
9394
max_connections: The maximum number of concurrent HTTP connections that
9495
the pool should allow. Any attempt to send a request on a pool that
9596
would exceed this amount will block until a connection is available.

httpcore/_backends/trio.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ async def start_tls(
8282

8383
def get_extra_info(self, info: str) -> typing.Any:
8484
if info == "ssl_object" and isinstance(self._stream, trio.SSLStream):
85-
# Type checkers cannot see `_ssl_object` attribute because trio._ssl.SSLStream uses __getattr__/__setattr__.
85+
# Type checkers cannot see `_ssl_object` attribute
86+
# because `trio._ssl.SSLStream` uses `__getattr__`/`__setattr__`.
8687
# Tracked at https://github.com/python-trio/trio/issues/542
8788
return self._stream._ssl_object # type: ignore[attr-defined]
8889
if info == "client_addr":

pyproject.toml

+11-10
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ include = [
6060
"/httpcore",
6161
"/CHANGELOG.md",
6262
"/README.md",
63-
"/tests"
63+
"/tests",
6464
]
6565

6666
[tool.hatch.metadata.hooks.fancy-pypi-readme]
@@ -96,26 +96,27 @@ filterwarnings = ["error"]
9696

9797
[tool.coverage.run]
9898
omit = [
99-
"venv/*",
100-
"httpcore/_sync/*"
99+
"venv/*",
100+
"httpcore/_sync/*",
101+
]
102+
include = [
103+
"httpcore/*",
104+
"tests/*",
101105
]
102-
include = ["httpcore/*", "tests/*"]
103106

104107
[tool.ruff]
105108
exclude = [
106109
"httpcore/_sync",
107110
"tests/_sync",
108111
]
109-
line-length = 88
112+
113+
[tool.ruff.lint]
110114
select = [
111115
"E",
112116
"F",
113117
"W",
114-
"I"
118+
"I",
115119
]
116120

117-
[tool.ruff.pycodestyle]
118-
max-line-length = 120
119-
120-
[tool.ruff.isort]
121+
[tool.ruff.lint.isort]
121122
combine-as-imports = true

tests/_async/test_connection.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ async def test_http_connection():
4242
assert repr(conn) == "<AsyncHTTPConnection [CONNECTING]>"
4343

4444
async with conn.stream("GET", "https://example.com/") as response:
45-
assert (
46-
repr(conn)
47-
== "<AsyncHTTPConnection ['https://example.com:443', HTTP/1.1, ACTIVE, Request Count: 1]>"
45+
assert repr(conn) == (
46+
"<AsyncHTTPConnection ['https://example.com:443', HTTP/1.1, ACTIVE,"
47+
" Request Count: 1]>"
4848
)
4949
await response.aread()
5050

@@ -55,9 +55,9 @@ async def test_http_connection():
5555
assert not conn.is_closed()
5656
assert conn.is_available()
5757
assert not conn.has_expired()
58-
assert (
59-
repr(conn)
60-
== "<AsyncHTTPConnection ['https://example.com:443', HTTP/1.1, IDLE, Request Count: 1]>"
58+
assert repr(conn) == (
59+
"<AsyncHTTPConnection ['https://example.com:443', HTTP/1.1, IDLE,"
60+
" Request Count: 1]>"
6161
)
6262

6363

0 commit comments

Comments
 (0)