refactor(project): make pyright & ruff happy
This commit is contained in:
@@ -31,9 +31,7 @@ class RedisSubscriber:
|
||||
|
||||
async def listen(self):
|
||||
while True:
|
||||
message = await self.pubsub.get_message(
|
||||
ignore_subscribe_messages=True, timeout=None
|
||||
)
|
||||
message = await self.pubsub.get_message(ignore_subscribe_messages=True, timeout=None)
|
||||
if message is not None and message["type"] == "message":
|
||||
matched_handlers: list[Callable[[str, str], Awaitable[Any]]] = []
|
||||
|
||||
@@ -53,10 +51,7 @@ class RedisSubscriber:
|
||||
|
||||
if matched_handlers:
|
||||
await asyncio.gather(
|
||||
*[
|
||||
handler(message["channel"], message["data"])
|
||||
for handler in matched_handlers
|
||||
]
|
||||
*[handler(message["channel"], message["data"]) for handler in matched_handlers]
|
||||
)
|
||||
|
||||
def start(self):
|
||||
|
||||
@@ -46,12 +46,7 @@ class ScoreSubscriber(RedisSubscriber):
|
||||
return
|
||||
async with with_db() as session:
|
||||
score = await session.get(Score, score_id)
|
||||
if (
|
||||
not score
|
||||
or not score.passed
|
||||
or score.room_id is None
|
||||
or score.playlist_item_id is None
|
||||
):
|
||||
if not score or not score.passed or score.room_id is None or score.playlist_item_id is None:
|
||||
return
|
||||
if not self.room_subscriber.get(score.room_id, []):
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user