From a0da83d8d36389618df6fe3bd4ee862cfd68da82 Mon Sep 17 00:00:00 2001 From: Estrella Pan Date: Fri, 3 Jul 2026 14:26:40 +0200 Subject: [PATCH] fix(types): annotate CursorResult.rowcount for mypy in delete_orphans Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01FAxVyRwrY7z5NotTtgnwVs --- backend/src/module/database/torrent.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/src/module/database/torrent.py b/backend/src/module/database/torrent.py index 1ef2e038..a7d72a15 100644 --- a/backend/src/module/database/torrent.py +++ b/backend/src/module/database/torrent.py @@ -154,7 +154,8 @@ class TorrentDatabase: delete(Torrent).where(Torrent.bangumi_id.is_(None)) # type: ignore[union-attr] ) await self.session.commit() - count = result.rowcount + # execute(delete()) 返回 CursorResult,mypy 只能推断出基类 Result[Any] + count = result.rowcount # type: ignore[attr-defined] if count > 0: logger.debug("Deleted %s orphan torrents.", count) return count