diff --git a/pyproject.toml b/pyproject.toml index 4417405..be73088 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -159,7 +159,7 @@ dev = [ [project] name = "sqlrepo" -version = "1.5.0" +version = "1.5.1" description = "sqlalchemy repositories with crud operations and other utils for it." authors = [{ name = "Dmitriy Lunev", email = "dima.lunev14@gmail.com" }] requires-python = ">=3.11" diff --git a/sqlrepo/ext/fastapi/containers.py b/sqlrepo/ext/fastapi/containers.py index 8214598..088dbc7 100644 --- a/sqlrepo/ext/fastapi/containers.py +++ b/sqlrepo/ext/fastapi/containers.py @@ -3,6 +3,8 @@ from fastapi import Depends, Request if TYPE_CHECKING: + from collections.abc import AsyncGenerator, Generator + from fastapi import FastAPI from sqlalchemy.ext.asyncio import AsyncSession from sqlalchemy.orm.session import Session @@ -11,13 +13,13 @@ class SyncSessionDependsProtocol(Protocol): """Sync session depends protocol for FastAPI framework.""" @staticmethod - def __call__() -> Session: ... # noqa: D102 + def __call__() -> Session | Generator[Session, None, None]: ... # noqa: D102 class AsyncSessionDependsProtocol(Protocol): """Async session depends protocol for FastAPI framework.""" @staticmethod - async def __call__() -> AsyncSession: ... # noqa: D102 + async def __call__() -> AsyncSession | AsyncGenerator[AsyncSession, None]: ... # noqa: D102 def _get_session_stub() -> None: