Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 17, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion stdlib/2and3/contextlib.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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]: ...