Skip to content

Commit 208bf3c

Browse files
committed
Ruff fixes
1 parent 9dbd10d commit 208bf3c

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

plugwise_usb/connection/queue.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
from asyncio import Queue, Task, get_running_loop, sleep
66
from collections.abc import Callable
77
from dataclasses import dataclass
8-
from sortedcontainers import SortedList
98
import logging
109

10+
from sortedcontainers import SortedList
11+
1112
from ..api import StickEvent
1213
from ..exceptions import MessageError, NodeTimeout, StickError, StickTimeout
1314
from ..messages import Priority
@@ -31,6 +32,7 @@ class DroppingPriorityQueue(Queue):
3132
3233
Older entries are dropped when the queue reaches its maximum size.
3334
"""
35+
3436
def _init(self, maxsize):
3537
# called by asyncio.Queue.__init__
3638
self._queue = SortedList()
@@ -52,7 +54,7 @@ def __drop(self):
5254
self.task_done()
5355

5456
def put_nowait(self, item):
55-
""" Override method for queue.put."""
57+
"""Override method for queue.put."""
5658
if self.full():
5759
self.__drop()
5860
super().put_nowait(item)
@@ -72,7 +74,9 @@ def __init__(self) -> None:
7274
"""Initialize the message session controller."""
7375
self._stick: StickConnectionManager | None = None
7476
self._loop = get_running_loop()
75-
self._submit_queue: DroppingPriorityQueue[PlugwiseRequest] = DroppingPriorityQueue(maxsize=56)
77+
self._submit_queue: DroppingPriorityQueue[PlugwiseRequest] = (
78+
DroppingPriorityQueue(maxsize=56)
79+
)
7680
self._submit_worker_task: Task[None] | None = None
7781
self._unsubscribe_connection_events: Callable[[], None] | None = None
7882
self._running = False
@@ -187,7 +191,9 @@ async def _send_queue_worker(self) -> None:
187191
return
188192

189193
if self._stick.queue_depth > 3:
190-
_LOGGER.warning("Awaiting plugwise responses %d", self._stick.queue_depth)
194+
_LOGGER.warning(
195+
"Awaiting plugwise responses %d", self._stick.queue_depth
196+
)
191197
await sleep(0.125)
192198

193199
await self._stick.write_to_stick(request)

0 commit comments

Comments
 (0)