Ruff format/ Cleanup

This commit is contained in:
Vladless
2026-04-14 07:19:14 +00:00
parent 0e8b0d04f0
commit 39dd2432cc
224 changed files with 1583 additions and 1182 deletions
+2 -6
View File
@@ -2,8 +2,8 @@ from sqlalchemy import select
from sqlalchemy.dialects.postgresql import insert
from sqlalchemy.ext.asyncio import AsyncSession
from database.models import BlockedUser, User
from database.access.resolution import resolve_user_optional
from database.models import BlockedUser, User
from logger import logger
@@ -30,11 +30,7 @@ async def save_blocked_user_ids(session: AsyncSession, tg_ids: list[int]) -> Non
res = await session.execute(select(User.id, User.tg_id).where(User.tg_id.in_(batch)))
rows = res.all()
uid_by_tg = {int(tgid): int(uid) for uid, tgid in rows if tgid is not None}
values = [
{"user_id": uid_by_tg[int(tg)], "tg_id": int(tg)}
for tg in batch
if int(tg) in uid_by_tg
]
values = [{"user_id": uid_by_tg[int(tg)], "tg_id": int(tg)} for tg in batch if int(tg) in uid_by_tg]
if not values:
continue
stmt = insert(BlockedUser).values(values).on_conflict_do_nothing(index_elements=[BlockedUser.user_id])