fix(mypy): use CursorResult type annotation for bulk_toggle_scholars
This commit is contained in:
parent
3e933998a0
commit
39c7eb686c
1 changed files with 5 additions and 3 deletions
|
|
@ -63,9 +63,11 @@ async def bulk_toggle_scholars(
|
||||||
scholar_profile_ids: list[int],
|
scholar_profile_ids: list[int],
|
||||||
is_enabled: bool,
|
is_enabled: bool,
|
||||||
) -> int:
|
) -> 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)
|
update(ScholarProfile)
|
||||||
.where(
|
.where(
|
||||||
ScholarProfile.id.in_(scholar_profile_ids),
|
ScholarProfile.id.in_(scholar_profile_ids),
|
||||||
|
|
@ -74,7 +76,7 @@ async def bulk_toggle_scholars(
|
||||||
.values(is_enabled=is_enabled)
|
.values(is_enabled=is_enabled)
|
||||||
)
|
)
|
||||||
await db_session.commit()
|
await db_session.commit()
|
||||||
return int(cursor.rowcount)
|
return int(cursor.rowcount or 0)
|
||||||
|
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue