]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Improved PEP-484 for run_sync 5778/head
authorMichael Oliver <michael.oliver@buffalogrid.com>
Wed, 16 Dec 2020 16:28:14 +0000 (16:28 +0000)
committerMichael Oliver <michael.oliver@buffalogrid.com>
Wed, 16 Dec 2020 16:28:14 +0000 (16:28 +0000)
lib/sqlalchemy/ext/asyncio/session.py

index 4ae1fb385ec96bcc781af853e1cb61994df0ef4c..c21b67954327b368b818813c7c89fecb64598a06 100644 (file)
@@ -1,7 +1,7 @@
-from typing import Any
 from typing import Callable
 from typing import Mapping
 from typing import Optional
+from typing import TypeVar
 
 from . import engine
 from . import result as _result
@@ -14,6 +14,9 @@ from ...sql import Executable
 from ...util.concurrency import greenlet_spawn
 
 
+T = TypeVar("T")
+
+
 @util.create_proxy_methods(
     Session,
     ":class:`_orm.Session`",
@@ -102,7 +105,7 @@ class AsyncSession:
             with_for_update=with_for_update,
         )
 
-    async def run_sync(self, fn: Callable, *arg, **kw) -> Any:
+    async def run_sync(self, fn: Callable[..., T], *arg, **kw) -> T:
         """Invoke the given sync callable passing sync self as the first
         argument.