Add stub for AsyncExitContext added by bpo-29302. (#1876)

* Add stub for AsyncExitContext added by bpo-29302.

* ExitStack's pop_all returns an instance of type(self).
This commit is contained in:
Ilya Kulakov
2018-02-16 17:17:17 -08:00
committed by Jelle Zijlstra
parent 18ae67d040
commit 1e8b953182

View File

@@ -61,6 +61,31 @@ if sys.version_info >= (3,):
def push(self, exit: _CM_EF) -> _CM_EF: ...
def callback(self, callback: Callable[..., None],
*args: Any, **kwds: Any) -> Callable[..., None]: ...
def pop_all(self) -> ExitStack: ...
def pop_all(self: _U) -> _U: ...
def close(self) -> None: ...
def __enter__(self: _U) -> _U: ...
if sys.version_info >= (3, 7):
from typing import Awaitable
_U = TypeVar('_U', bound='AsyncExitStack')
_ExitCoroFunc = Callable[[Optional[Type[BaseException]],
Optional[BaseException],
Optional[TracebackType]], Awaitable[bool]]
_CallbackCoroFunc = Callable[..., Awaitable[None]]
_ACM_EF = TypeVar('_ACM_EF', AsyncContextManager, _ExitCoroFunc)
class AsyncExitStack(AsyncContextManager[AsyncExitStack]):
def __init__(self) -> None: ...
def enter_context(self, cm: ContextManager[_T]) -> _T: ...
def enter_async_context(self, cm: AsyncContextManager[_T]) -> Awaitable[_T]: ...
def push(self, exit: _CM_EF) -> _CM_EF: ...
def push_async_exit(self, exit: _ACM_EF) -> _ACM_EF: ...
def callback(self, callback: Callable[..., None],
*args: Any, **kwds: Any) -> Callable[..., None]: ...
def push_async_callback(self, callback: _CallbackCoroFunc,
*args: Any, **kwds: Any) -> _CallbackCoroFunc: ...
def pop_all(self: _U) -> _U: ...
def aclose(self) -> Awaitable[None]: ...
def __aenter__(self: _U) -> Awaitable[_U]: ...