chore(tests): fix mypy errors

This commit is contained in:
grossmj committed 2026-10-01 15:22:17 +02:00
1 parent 285af128f2
commit 1456d36bf0
5 files changed
+16 -14

No files matched your search

+4 -3
View File
@@ -154,7 +154,7 @@ class ImagesRepository(BaseRepository):
await self._db_session.refresh(image_db) # force refresh of updated_at value
return image_db
async def save_verified_image(self, info: dict) -> models.Image:
async def save_verified_image(self, info: dict) -> Optional[models.Image]:
"""Upsert an exact path, preserving template associations and the image ID.
Callers coordinate publication/inspection with image_lock(). Each commit
@@ -217,11 +217,12 @@ class ImagesRepository(BaseRepository):
except Exception:
await self._db_session.rollback()
raise
return None
async def delete_image_exact(self, image_id: int) -> bool:
result = await self._db_session.execute(delete(models.Image).where(models.Image.image_id == image_id))
await self._db_session.commit()
return result.rowcount > 0
return cast(CursorResult, result).rowcount > 0
async def delete_image(self, image_path: str) -> bool:
"""
@@ -246,7 +247,7 @@ class ImagesRepository(BaseRepository):
await self._db_session.commit()
return cast(CursorResult, result).rowcount > 0
async def prune_images(self, skip_images: Optional[list[str]] = None, is_in_use: Optional[Callable] = None) -> int:
async def prune_images(self, skip_images: Optional[list[str]] = None, is_in_use: Optional[Callable] = None) -> int:
"""
Prune images not attached to any template.
"""
+1 -1
View File
@@ -203,7 +203,7 @@ async def update_disk_checksums(updated_disks: List[str]) -> None:
repository = ImagesRepository(db_session)
image = await repository.get_image(path)
if image:
info = await read_image_info(path, image.image_type, allow_raw_image=True)
info = await read_image_info(path, str(image.image_type), allow_raw_image=True)
try:
os.unlink(path + ".md5sum")
except FileNotFoundError: