Skip to content

Commit

Permalink
use typing.Self
Browse files Browse the repository at this point in the history
  • Loading branch information
keakon committed May 22, 2024
1 parent 5bfc2b3 commit 615e6dd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, Sequence, Type, TypeGuard, TypeVar
from typing import Any, Self, Sequence, Type, TypeGuard, TypeVar

from sqlalchemy import Column, Row
from sqlalchemy.ext.asyncio import AsyncSession
Expand Down Expand Up @@ -59,7 +59,7 @@ async def get_by_ids(
columns: list | tuple | InstrumentedAttribute | TextClause | Column | Mapped | None = None,
for_update: bool = False,
for_read: bool = False,
) -> 'Sequence[BaseModel | Row]':
) -> Sequence[Self | Row]:
if not ids:
return []
if columns is None:
Expand Down Expand Up @@ -98,7 +98,7 @@ async def get_all(
columns: list | tuple | InstrumentedAttribute | Mapped | None = None,
for_update: bool = False,
for_read: bool = False,
) -> 'Sequence[BaseModel | Row]':
) -> Sequence[Self | Row]:
if columns is None:
query = select(cls)
scalar = True
Expand Down

0 comments on commit 615e6dd

Please sign in to comment.