From: Sam Bull Date: Sat, 19 Nov 2022 14:54:02 +0000 (+0000) Subject: Fix inferred type of async_sessionmaker X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1681c23ae295a99cb01f65b3656a95a1aeb38487;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Fix inferred type of async_sessionmaker --- diff --git a/lib/sqlalchemy/ext/asyncio/session.py b/lib/sqlalchemy/ext/asyncio/session.py index 1956ea588a..6849d258e0 100644 --- a/lib/sqlalchemy/ext/asyncio/session.py +++ b/lib/sqlalchemy/ext/asyncio/session.py @@ -1436,6 +1436,40 @@ class async_sessionmaker(Generic[_AS]): class_: Type[_AS] + @overload + def __init__( + self: async_sessionmaker[AsyncSession], + bind: Optional[_AsyncSessionBind] = None, + *, + autoflush: bool = True, + expire_on_commit: bool = True, + info: Optional[_InfoType] = None, + **kw: Any, + ): + ... + @overload + def __init__( + self, + bind: Optional[_AsyncSessionBind], + class_: Type[_AS], # type: ignore + autoflush: bool = True, + expire_on_commit: bool = True, + info: Optional[_InfoType] = None, + **kw: Any, + ): + ... + @overload + def __init__( + self, + bind: Optional[_AsyncSessionBind] = ..., + *, + class_: Type[_AS], # type: ignore + autoflush: bool = True, + expire_on_commit: bool = True, + info: Optional[_InfoType] = None, + **kw: Any, + ): + ... def __init__( self, bind: Optional[_AsyncSessionBind] = None,