refactor(project): make pyright & ruff happy

This commit is contained in:
MingxuanGame
2025-08-22 08:21:52 +00:00
parent 3b1d7a2234
commit 598fcc8b38
157 changed files with 2382 additions and 4590 deletions

View File

@@ -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):

View File

@@ -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