Skip to content

Commit 8347da0

Browse files
committed
chore: ruff format
1 parent 4cd2574 commit 8347da0

File tree

5 files changed

+32
-33
lines changed

5 files changed

+32
-33
lines changed

src/flockwave/server/command_handlers/color.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,10 @@ async def _color_command_handler(
6565
return "Color override turned off"
6666

6767

68-
def create_color_command_handler() -> (
69-
Callable[
70-
[UAVDriver, UAV, Optional[Union[str, int]], Optional[int], Optional[int]],
71-
Awaitable[str],
72-
]
73-
):
68+
def create_color_command_handler() -> Callable[
69+
[UAVDriver, UAV, Optional[Union[str, int]], Optional[int], Optional[int]],
70+
Awaitable[str],
71+
]:
7472
"""Creates a generic async command handler function that allows the user to
7573
set the color of the LED lights on the UAV, assuming that the UAV
7674
has an async or sync method named `set_led_color()`.

src/flockwave/server/message_hub.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,9 @@ async def broadcast_message(self, message: FlockwaveNotification) -> Request:
242242
the request object that identifies this message in the outbound
243243
message queue. It can be used to wait until the message is delivered
244244
"""
245-
assert isinstance(
246-
message, FlockwaveNotification
247-
), "only notifications may be broadcast"
245+
assert isinstance(message, FlockwaveNotification), (
246+
"only notifications may be broadcast"
247+
)
248248

249249
request = Request(message)
250250
await self._queue_tx.send(request)
@@ -379,9 +379,9 @@ def enqueue_broadcast_message(self, message: FlockwaveNotification) -> None:
379379
Parameters:
380380
message: the notification to enqueue
381381
"""
382-
assert isinstance(
383-
message, FlockwaveNotification
384-
), "only notifications may be broadcast"
382+
assert isinstance(message, FlockwaveNotification), (
383+
"only notifications may be broadcast"
384+
)
385385

386386
# Don't return the request here because it is not guaranteed that it
387387
# ends up in the queue; it may be dropped
@@ -423,9 +423,9 @@ def enqueue_message(
423423
message, in_response_to=in_response_to
424424
)
425425
if to is None:
426-
assert isinstance(
427-
message, FlockwaveNotification
428-
), "broadcast messages cannot be sent in response to a particular message"
426+
assert isinstance(message, FlockwaveNotification), (
427+
"broadcast messages cannot be sent in response to a particular message"
428+
)
429429
return self.enqueue_broadcast_message(message)
430430
else:
431431
# Don't return the request here because it is not guaranteed that it
@@ -549,12 +549,12 @@ def _commit_broadcast_methods(
549549
"""Calculates the list of methods to call when the message hub
550550
wishes to broadcast a message to all the connected clients.
551551
"""
552-
assert (
553-
self._client_registry is not None
554-
), "message hub does not have a client registry yet"
555-
assert (
556-
self._channel_type_registry is not None
557-
), "message hub does not have a channel type registry yet"
552+
assert self._client_registry is not None, (
553+
"message hub does not have a client registry yet"
554+
)
555+
assert self._channel_type_registry is not None, (
556+
"message hub does not have a channel type registry yet"
557+
)
558558

559559
result = []
560560
clients_for = self._client_registry.client_ids_for_channel_type
@@ -832,9 +832,9 @@ async def send_message(
832832
)
833833

834834
if to is None:
835-
assert isinstance(
836-
message, FlockwaveNotification
837-
), "broadcast messages cannot be sent in response to a particular message"
835+
assert isinstance(message, FlockwaveNotification), (
836+
"broadcast messages cannot be sent in response to a particular message"
837+
)
838838
return await self.broadcast_message(message)
839839
else:
840840
request = Request(message, to=to, in_response_to=in_response_to)
@@ -1068,9 +1068,9 @@ async def _send_message(
10681068
in_response_to: Optional[FlockwaveMessage] = None,
10691069
done: Optional[Callable[[], None]] = None,
10701070
):
1071-
assert (
1072-
self._client_registry is not None
1073-
), "message hub does not have a client registry yet"
1071+
assert self._client_registry is not None, (
1072+
"message hub does not have a client registry yet"
1073+
)
10741074

10751075
if not isinstance(to, Client):
10761076
try:

src/flockwave/server/model/devices.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ def _add_child(self, id: str, node: C) -> C:
338338
self.children = {}
339339
if id in self.children:
340340
raise ValueError(
341-
"another child node already exists with " "ID={0!r}".format(id)
341+
"another child node already exists with ID={0!r}".format(id)
342342
)
343343
self.children[id] = node
344344

src/flockwave/server/registries/channels.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,9 @@ def create_channel_for(self, channel_id):
140140
type.
141141
"""
142142
result = self._entries[channel_id].factory()
143-
assert isinstance(
144-
result, CommunicationChannel
145-
), "communication channel factory did not return a CommunicationChannel"
143+
assert isinstance(result, CommunicationChannel), (
144+
"communication channel factory did not return a CommunicationChannel"
145+
)
146146
return result
147147

148148
@property

src/flockwave/server/registries/connections.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,9 @@ def add(
8080
"""
8181
if name in self:
8282
raise KeyError(
83-
"another connection is already registered "
84-
"with this name: {0!r}".format(name)
83+
"another connection is already registered with this name: {0!r}".format(
84+
name
85+
)
8586
)
8687

8788
purpose = purpose if purpose is not None else ConnectionPurpose.other

0 commit comments

Comments
 (0)