From 615e6dde7b87728fc6a899c6a915078624c393b8 Mon Sep 17 00:00:00 2001 From: keakon Date: Wed, 22 May 2024 20:38:02 +0800 Subject: [PATCH] use typing.Self --- app/models/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/__init__.py b/app/models/__init__.py index b8f36c2..6076f9d 100644 --- a/app/models/__init__.py +++ b/app/models/__init__.py @@ -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 @@ -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: @@ -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