generated from john/python-template
chore: make ty check blocking with targeted suppressions
Co-authored-by: Copilot App <[email protected]>
This commit is contained in:
co-authored by
Copilot App
parent
a2bb1acd6b
commit
26f9c83f54
@@ -178,25 +178,33 @@ class PhotosService(ServiceBase):
|
||||
async def _list_owner_photos(self, *, session: AsyncSession, person_id: UUID | None) -> list[Photo]:
|
||||
query = select(Photo)
|
||||
if person_id is None:
|
||||
query = query.where(Photo.person_id.is_(None))
|
||||
query = query.where(Photo.person_id.is_(None)) # ty: ignore[unresolved-attribute] - SQLAlchemy descriptor false positive.
|
||||
else:
|
||||
query = query.where(Photo.person_id == person_id)
|
||||
query = query.order_by(Photo.created_at.asc(), Photo.id.asc())
|
||||
query = query.order_by(
|
||||
Photo.created_at.asc(), # ty: ignore[unresolved-attribute] - SQLAlchemy descriptor false positive.
|
||||
Photo.id.asc(), # ty: ignore[unresolved-attribute] - SQLAlchemy descriptor false positive.
|
||||
)
|
||||
return list((await session.exec(query)).all())
|
||||
|
||||
async def _owner_oldest_photo(self, *, session: AsyncSession, person_id: UUID | None) -> Photo | None:
|
||||
query = select(Photo)
|
||||
if person_id is None:
|
||||
query = query.where(Photo.person_id.is_(None))
|
||||
query = query.where(Photo.person_id.is_(None)) # ty: ignore[unresolved-attribute] - SQLAlchemy descriptor false positive.
|
||||
else:
|
||||
query = query.where(Photo.person_id == person_id)
|
||||
query = query.order_by(Photo.created_at.asc(), Photo.id.asc()).limit(1)
|
||||
query = query.order_by(
|
||||
Photo.created_at.asc(), # ty: ignore[unresolved-attribute] - SQLAlchemy descriptor false positive.
|
||||
Photo.id.asc(), # ty: ignore[unresolved-attribute] - SQLAlchemy descriptor false positive.
|
||||
).limit(1)
|
||||
return (await session.exec(query)).first()
|
||||
|
||||
async def _clear_owner_primary(self, *, session: AsyncSession, person_id: UUID | None) -> None:
|
||||
query = select(Photo).where(Photo.is_primary.is_(True))
|
||||
query = select(Photo).where(
|
||||
Photo.is_primary.is_(True) # ty: ignore[unresolved-attribute] - SQLAlchemy descriptor false positive.
|
||||
)
|
||||
if person_id is None:
|
||||
query = query.where(Photo.person_id.is_(None))
|
||||
query = query.where(Photo.person_id.is_(None)) # ty: ignore[unresolved-attribute] - SQLAlchemy descriptor false positive.
|
||||
else:
|
||||
query = query.where(Photo.person_id == person_id)
|
||||
for current in (await session.exec(query)).all():
|
||||
|
||||
Reference in New Issue
Block a user