From 71cb17c81d358646f8dfeac14e9662ce42bb94df Mon Sep 17 00:00:00 2001 From: Federico Caselli Date: Thu, 13 May 2021 21:20:51 +0200 Subject: 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 --- lib/sqlalchemy/ext/asyncio/session.py | 42 ++++++++++------------------------- 1 file changed, 12 insertions(+), 30 deletions(-) (limited to 'lib/sqlalchemy/ext/asyncio/session.py') 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( -- cgit v1.2.1