Skip to content

Commit

Permalink
Upgrade to black 2023 style.
Browse files Browse the repository at this point in the history
Changes stem from psf/black#3035.
  • Loading branch information
aaugustin committed Feb 19, 2023
1 parent 206d7ef commit 4aa91dc
Show file tree
Hide file tree
Showing 9 changed files with 0 additions and 25 deletions.
4 changes: 0 additions & 4 deletions src/websockets/client.py
Expand Up @@ -222,7 +222,6 @@ def process_extensions(self, headers: Headers) -> List[Extension]:
extensions = headers.get_all("Sec-WebSocket-Extensions")

if extensions:

if self.available_extensions is None:
raise InvalidHandshake("no extensions supported")

Expand All @@ -231,9 +230,7 @@ def process_extensions(self, headers: Headers) -> List[Extension]:
)

for name, response_params in parsed_extensions:

for extension_factory in self.available_extensions:

# Skip non-matching extensions based on their name.
if extension_factory.name != name:
continue
Expand Down Expand Up @@ -280,7 +277,6 @@ def process_subprotocol(self, headers: Headers) -> Optional[Subprotocol]:
subprotocols = headers.get_all("Sec-WebSocket-Protocol")

if subprotocols:

if self.available_subprotocols is None:
raise InvalidHandshake("no subprotocols supported")

Expand Down
1 change: 0 additions & 1 deletion src/websockets/extensions/permessage_deflate.py
Expand Up @@ -211,7 +211,6 @@ def _extract_parameters(
client_max_window_bits: Optional[Union[int, bool]] = None

for name, value in params:

if name == "server_no_context_takeover":
if server_no_context_takeover:
raise exceptions.DuplicateParameter(name)
Expand Down
4 changes: 0 additions & 4 deletions src/websockets/legacy/client.py
Expand Up @@ -188,7 +188,6 @@ def process_extensions(
header_values = headers.get_all("Sec-WebSocket-Extensions")

if header_values:

if available_extensions is None:
raise InvalidHandshake("no extensions supported")

Expand All @@ -197,9 +196,7 @@ def process_extensions(
)

for name, response_params in parsed_header_values:

for extension_factory in available_extensions:

# Skip non-matching extensions based on their name.
if extension_factory.name != name:
continue
Expand Down Expand Up @@ -245,7 +242,6 @@ def process_subprotocol(
header_values = headers.get_all("Sec-WebSocket-Protocol")

if header_values:

if available_subprotocols is None:
raise InvalidHandshake("no subprotocols supported")

Expand Down
1 change: 0 additions & 1 deletion src/websockets/legacy/framing.py
Expand Up @@ -14,7 +14,6 @@


class Frame(NamedTuple):

fin: bool
opcode: frames.Opcode
data: bytes
Expand Down
2 changes: 0 additions & 2 deletions src/websockets/legacy/protocol.py
Expand Up @@ -652,7 +652,6 @@ async def send(
# Fragmented message -- regular iterator.

elif isinstance(message, Iterable):

# Work around https://github.com/python/mypy/issues/6227
message = cast(Iterable[Data], message)

Expand Down Expand Up @@ -1519,7 +1518,6 @@ def connection_lost(self, exc: Optional[Exception]) -> None:
self.connection_lost_waiter.set_result(None)

if True: # pragma: no cover

# Copied from asyncio.StreamReaderProtocol
if self.reader is not None:
if exc is None:
Expand Down
5 changes: 0 additions & 5 deletions src/websockets/legacy/server.py
Expand Up @@ -160,7 +160,6 @@ async def handler(self) -> None:
"""
try:

try:
await self.handshake(
origins=self.origins,
Expand Down Expand Up @@ -443,15 +442,12 @@ def process_extensions(
header_values = headers.get_all("Sec-WebSocket-Extensions")

if header_values and available_extensions:

parsed_header_values: List[ExtensionHeader] = sum(
[parse_extension(header_value) for header_value in header_values], []
)

for name, request_params in parsed_header_values:

for ext_factory in available_extensions:

# Skip non-matching extensions based on their name.
if ext_factory.name != name:
continue
Expand Down Expand Up @@ -503,7 +499,6 @@ def process_subprotocol(
header_values = headers.get_all("Sec-WebSocket-Protocol")

if header_values and available_subprotocols:

parsed_header_values: List[Subprotocol] = sum(
[parse_subprotocol(header_value) for header_value in header_values], []
)
Expand Down
3 changes: 0 additions & 3 deletions src/websockets/server.py
Expand Up @@ -354,15 +354,12 @@ def process_extensions(
header_values = headers.get_all("Sec-WebSocket-Extensions")

if header_values and self.available_extensions:

parsed_header_values: List[ExtensionHeader] = sum(
[parse_extension(header_value) for header_value in header_values], []
)

for name, request_params in parsed_header_values:

for ext_factory in self.available_extensions:

# Skip non-matching extensions based on their name.
if ext_factory.name != name:
continue
Expand Down
1 change: 0 additions & 1 deletion tests/legacy/test_auth.py
Expand Up @@ -32,7 +32,6 @@ async def check_credentials(self, username, password):


class AuthClientServerTests(ClientServerTestsMixin, AsyncioTestCase):

create_protocol = basic_auth_protocol_factory(
realm="auth-tests", credentials=("hello", "iloveyou")
)
Expand Down
4 changes: 0 additions & 4 deletions tests/legacy/test_client_server.py
Expand Up @@ -212,7 +212,6 @@ class BarClientProtocol(WebSocketClientProtocol):


class ClientServerTestsMixin:

secure = False

def setUp(self):
Expand Down Expand Up @@ -309,7 +308,6 @@ def make_http_request(self, path="/", headers=None):


class SecureClientServerTestsMixin(ClientServerTestsMixin):

secure = True

@property
Expand Down Expand Up @@ -1299,7 +1297,6 @@ class ClientServerTests(
class SecureClientServerTests(
CommonClientServerTests, SecureClientServerTestsMixin, AsyncioTestCase
):

# The implementation of this test makes it hard to run it over TLS.
test_client_connect_canceled_during_handshake = None

Expand Down Expand Up @@ -1462,7 +1459,6 @@ async def run_server(path):


class AsyncIteratorTests(ClientServerTestsMixin, AsyncioTestCase):

# This is a protocol-level feature, but since it's a high-level API, it is
# much easier to exercise at the client or server level.

Expand Down

0 comments on commit 4aa91dc

Please sign in to comment.