diff options
author | Federico Caselli <cfederico87@gmail.com> | 2021-05-13 21:20:51 +0200 |
---|---|---|
committer | Federico Caselli <cfederico87@gmail.com> | 2021-05-16 11:11:10 +0200 |
commit | 71cb17c81d358646f8dfeac14e9662ce42bb94df (patch) | |
tree | 8ea3a686ffd0b9fea4fa7f91acfd8987d9369d9a /lib/sqlalchemy/ext/asyncio/session.py | |
parent | 0d5508d77653b37368ff9de22307c154cc90cf71 (diff) | |
download | sqlalchemy-71cb17c81d358646f8dfeac14e9662ce42bb94df.tar.gz |
Remove pep484 type comments from the code
Current effort is around the stub package, and having typing in
two places makes thing worse, since the types here are usually
outdated compared to the version in the stubs.
Once v2 gets under way we can start consolidating the types
here.
Fixes: #6461
Change-Id: I7132a444bd7138123074bf5bc664b4bb119a85ce
Diffstat (limited to 'lib/sqlalchemy/ext/asyncio/session.py')
-rw-r--r-- | lib/sqlalchemy/ext/asyncio/session.py | 42 |
1 files changed, 12 insertions, 30 deletions
diff --git a/lib/sqlalchemy/ext/asyncio/session.py b/lib/sqlalchemy/ext/asyncio/session.py index 1b61d6ee3..8d19819b0 100644 --- a/lib/sqlalchemy/ext/asyncio/session.py +++ b/lib/sqlalchemy/ext/asyncio/session.py @@ -4,27 +4,14 @@ # # This module is part of SQLAlchemy and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php - -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 from .base import StartableContext -from .engine import AsyncEngine from ... import util -from ...engine import Result from ...orm import Session -from ...sql import Executable from ...util.concurrency import greenlet_spawn -T = TypeVar("T") - - @util.create_proxy_methods( Session, ":class:`_orm.Session`", @@ -72,12 +59,7 @@ class AsyncSession: dispatch = None - def __init__( - self, - bind: AsyncEngine = None, - binds: Mapping[object, AsyncEngine] = None, - **kw - ): + def __init__(self, bind=None, binds=None, **kw): kw["future"] = True if bind: self.bind = bind @@ -114,7 +96,7 @@ class AsyncSession: with_for_update=with_for_update, ) - async def run_sync(self, fn: Callable[..., T], *arg, **kw) -> T: + async def run_sync(self, fn, *arg, **kw): """Invoke the given sync callable passing sync self as the first argument. @@ -143,12 +125,12 @@ class AsyncSession: async def execute( self, - statement: Executable, - params: Optional[Mapping] = None, - execution_options: Mapping = util.EMPTY_DICT, - bind_arguments: Optional[Mapping] = None, + statement, + params=None, + execution_options=util.EMPTY_DICT, + bind_arguments=None, **kw - ) -> Result: + ): """Execute a statement and return a buffered :class:`_engine.Result` object.""" @@ -165,12 +147,12 @@ class AsyncSession: async def scalar( self, - statement: Executable, - params: Optional[Mapping] = None, - execution_options: Mapping = util.EMPTY_DICT, - bind_arguments: Optional[Mapping] = None, + statement, + params=None, + execution_options=util.EMPTY_DICT, + bind_arguments=None, **kw - ) -> Any: + ): """Execute a statement and return a scalar result.""" result = await self.execute( |