-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Changes from 2 commits
a14d125
7fe061d
f207d24
216b3b6
598b57c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -64,3 +64,29 @@ if sys.version_info >= (3,): | |
| def pop_all(self) -> ExitStack: ... | ||
| 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) -> ExitStack: ... | ||
| def aclose(self) -> Awaitable[None]: ... | ||
| def __enter__(self: _U) -> _U: ... | ||
| def __aenter__(self: _U) -> Awaitable[_U]: ... | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you not need
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Base class implementations should be enough.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, that's true for
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or do you mean that's because
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, nvm. There is no |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should return AsyncExitStack.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I think it should be implemented as
__enter__/__aenter__:pop_allinstantiatestype(self).Probably that should also be fixed for
ExitStack.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Would you mind fixing it there too while you're at it?