From 307c640ea81ee4cd8673a6f21a5667444f6f5e24 Mon Sep 17 00:00:00 2001 From: h0rn3t Date: Wed, 16 Aug 2023 09:20:34 +0300 Subject: [PATCH] pre-commit --- fastapi_async_sqlalchemy/middleware.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fastapi_async_sqlalchemy/middleware.py b/fastapi_async_sqlalchemy/middleware.py index dbd67d6..40d5252 100644 --- a/fastapi_async_sqlalchemy/middleware.py +++ b/fastapi_async_sqlalchemy/middleware.py @@ -8,12 +8,13 @@ from starlette.requests import Request from starlette.types import ASGIApp +from fastapi_async_sqlalchemy.exceptions import MissingSessionError, SessionNotInitialisedError + try: from sqlalchemy.ext.asyncio import async_sessionmaker except ImportError: from sqlalchemy.orm import sessionmaker as async_sessionmaker -# isort: off -from fastapi_async_sqlalchemy.exceptions import MissingSessionError, SessionNotInitialisedError + _Session: Optional[async_sessionmaker] = None _session: ContextVar[Optional[AsyncSession]] = ContextVar("_session", default=None)