From 39c7eb686cbf4b5f93f42dfe1f590072655ab33a Mon Sep 17 00:00:00 2001 From: Justin Visser Date: Sat, 7 Mar 2026 16:16:55 +0100 Subject: [PATCH] fix(mypy): use CursorResult type annotation for bulk_toggle_scholars --- app/services/scholars/application.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/services/scholars/application.py b/app/services/scholars/application.py index fcd657c..07cf6b3 100644 --- a/app/services/scholars/application.py +++ b/app/services/scholars/application.py @@ -63,9 +63,11 @@ async def bulk_toggle_scholars( scholar_profile_ids: list[int], is_enabled: bool, ) -> int: - from sqlalchemy import update + from typing import Any - cursor = await db_session.execute( + from sqlalchemy import CursorResult, update + + cursor: CursorResult[Any] = await db_session.execute( # type: ignore[assignment] update(ScholarProfile) .where( ScholarProfile.id.in_(scholar_profile_ids), @@ -74,7 +76,7 @@ async def bulk_toggle_scholars( .values(is_enabled=is_enabled) ) await db_session.commit() - return int(cursor.rowcount) + return int(cursor.rowcount or 0) __all__ = [