Skip to content

Commit d4781a6

Browse files
authored
Merge pull request #47 from bryanforbes/improve-ext-asyncio-base
Improve `ext.asyncio.base`
2 parents 7bea6c2 + ad41aaa commit d4781a6

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

sqlalchemy-stubs/ext/asyncio/base.pyi

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
11
import abc
22
from typing import Any
3+
from typing import Generator
4+
from typing import TypeVar
5+
6+
_TStartableContext = TypeVar("_TStartableContext", bound=StartableContext)
37

48
class StartableContext(abc.ABC, metaclass=abc.ABCMeta):
59
@abc.abstractmethod
6-
async def start(self) -> StartableContext: ...
7-
def __await__(self): ...
8-
async def __aenter__(self): ...
10+
async def start(self: _TStartableContext) -> _TStartableContext: ...
11+
def __await__(
12+
self: _TStartableContext,
13+
) -> Generator[Any, None, _TStartableContext]: ...
14+
async def __aenter__(self: _TStartableContext) -> _TStartableContext: ...
915
@abc.abstractmethod
1016
async def __aexit__(
1117
self, type_: Any, value: Any, traceback: Any
12-
) -> Any: ...
18+
) -> None: ...
1319

1420
class ProxyComparable:
15-
def __hash__(self) -> Any: ...
16-
def __eq__(self, other: Any) -> Any: ...
17-
def __ne__(self, other: Any) -> Any: ...
21+
def __hash__(self) -> int: ...
22+
def __eq__(self, other: Any) -> bool: ...
23+
def __ne__(self, other: Any) -> bool: ...

0 commit comments

Comments
 (0)