Skip to content

Commit 916f841

Browse files
committed
Upgrade ruff.
1 parent e6d0ea1 commit 916f841

File tree

7 files changed

+8
-17
lines changed

7 files changed

+8
-17
lines changed

src/websockets/exceptions.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,7 @@ def __init__(self, response: http11.Response) -> None:
204204

205205
def __str__(self) -> str:
206206
return (
207-
"server rejected WebSocket connection: "
208-
f"HTTP {self.response.status_code:d}"
207+
f"server rejected WebSocket connection: HTTP {self.response.status_code:d}"
209208
)
210209

211210

src/websockets/http11.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@ class Request:
9494
@property
9595
def exception(self) -> Exception | None: # pragma: no cover
9696
warnings.warn( # deprecated in 10.3 - 2022-04-17
97-
"Request.exception is deprecated; "
98-
"use ServerProtocol.handshake_exc instead",
97+
"Request.exception is deprecated; use ServerProtocol.handshake_exc instead",
9998
DeprecationWarning,
10099
)
101100
return self._exception

src/websockets/legacy/exceptions.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ def __init__(
5252

5353
def __str__(self) -> str:
5454
return (
55-
f"HTTP {self.status:d}, "
56-
f"{len(self.headers)} headers, "
57-
f"{len(self.body)} bytes"
55+
f"HTTP {self.status:d}, {len(self.headers)} headers, {len(self.body)} bytes"
5856
)
5957

6058

src/websockets/sync/connection.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -412,8 +412,7 @@ def send(
412412
with self.send_context():
413413
if self.send_in_progress:
414414
raise ConcurrencyError(
415-
"cannot call send while another thread "
416-
"is already running send"
415+
"cannot call send while another thread is already running send"
417416
)
418417
if text is False:
419418
self.protocol.send_binary(message.encode())
@@ -424,8 +423,7 @@ def send(
424423
with self.send_context():
425424
if self.send_in_progress:
426425
raise ConcurrencyError(
427-
"cannot call send while another thread "
428-
"is already running send"
426+
"cannot call send while another thread is already running send"
429427
)
430428
if text is True:
431429
self.protocol.send_text(message)

tests/asyncio/test_server.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ async def test_connection_handler_raises_exception(self):
5959
await client.recv()
6060
self.assertEqual(
6161
str(raised.exception),
62-
"received 1011 (internal error); "
63-
"then sent 1011 (internal error)",
62+
"received 1011 (internal error); then sent 1011 (internal error)",
6463
)
6564

6665
async def test_existing_socket(self):

tests/sync/test_server.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ def test_connection_handler_raises_exception(self):
5858
client.recv()
5959
self.assertEqual(
6060
str(raised.exception),
61-
"received 1011 (internal error); "
62-
"then sent 1011 (internal error)",
61+
"received 1011 (internal error); then sent 1011 (internal error)",
6362
)
6463

6564
def test_existing_socket(self):

tests/test_client.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -638,8 +638,7 @@ def test_multiple_subprotocols_accepted(self):
638638
self.assertHandshakeError(
639639
client,
640640
InvalidHandshake,
641-
"invalid Sec-WebSocket-Protocol header: "
642-
"multiple values: superchat, chat",
641+
"invalid Sec-WebSocket-Protocol header: multiple values: superchat, chat",
643642
)
644643

645644

0 commit comments

Comments
 (0)