sqlalchemy: Annotate (Async)Session.__(a)enter__ (#7488)

This commit is contained in:
Joseph Young
2022-03-14 15:15:32 +00:00
committed by GitHub
parent 2f338ce077
commit 860db6f6c4
2 changed files with 4 additions and 2 deletions

View File

@@ -1,3 +1,4 @@
from _typeshed import Self
from typing import Any
from ...util import memoized_property
@@ -50,7 +51,7 @@ class AsyncSession(ReversibleProxy):
async def close(self): ...
@classmethod
async def close_all(cls): ...
async def __aenter__(self): ...
async def __aenter__(self: Self) -> Self: ...
async def __aexit__(self, type_, value, traceback) -> None: ...
# proxied from Session
identity_map: Any

View File

@@ -1,3 +1,4 @@
from _typeshed import Self
from collections.abc import Mapping
from typing import Any, TypeVar, overload
@@ -104,7 +105,7 @@ class Session(_SessionClassMethods):
query_cls: Any | None = ...,
) -> None: ...
connection_callable: Any
def __enter__(self): ...
def __enter__(self: Self) -> Self: ...
def __exit__(self, type_, value, traceback) -> None: ...
@property
def transaction(self): ...