summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/ext/asyncio/session.py
diff options
context:
space:
mode:
authorMichael Oliver <michael.oliver@buffalogrid.com>2020-12-16 11:49:07 -0500
committersqla-tester <sqla-tester@sqlalchemy.org>2020-12-16 11:49:07 -0500
commit5ed76152ada962b1bfb822d087f1af1ec345ef43 (patch)
treea3c8214634225d8c552ef8eca2f0c8910f973191 /lib/sqlalchemy/ext/asyncio/session.py
parent09fac89debfbdcccbf2bcc433f7bec7921cf62be (diff)
downloadsqlalchemy-5ed76152ada962b1bfb822d087f1af1ec345ef43.tar.gz
Improved PEP-484 for AsyncSession.run_sync
<!-- Provide a general summary of your proposed changes in the Title field above --> ### Description <!-- Describe your changes in detail --> I don't think this needs any test added. ### Checklist <!-- go over following points. check them with an `x` if they do apply, (they turn into clickable checkboxes once the PR is submitted, so no need to do everything at once) --> This pull request is: - [ ] A documentation / typographical error fix - Good to go, no issue or tests are needed - [x] A short code fix - please include the issue number, and create an issue if none exists, which must include a complete example of the issue. one line code fixes without an issue and demonstration will not be accepted. - Please include: `Fixes: #<issue number>` in the commit message - please include tests. one line code fixes without tests will not be accepted. - [ ] A new feature implementation - please include the issue number, and create an issue if none exists, which must include a complete example of how the feature would look. - Please include: `Fixes: #<issue number>` in the commit message - please include tests. Fixes: #5777 **Have a nice day!** Closes: #5778 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5778 Pull-request-sha: 618ddc84d27b9b67f9ae78fd457f94feff1ce160 Change-Id: Id46f70ddc14e8f8d7e402a4b3ce7e934509bef24
Diffstat (limited to 'lib/sqlalchemy/ext/asyncio/session.py')
-rw-r--r--lib/sqlalchemy/ext/asyncio/session.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/sqlalchemy/ext/asyncio/session.py b/lib/sqlalchemy/ext/asyncio/session.py
index 4ae1fb385..c21b67954 100644
--- a/lib/sqlalchemy/ext/asyncio/session.py
+++ b/lib/sqlalchemy/ext/asyncio/session.py
@@ -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.