mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 13:04:46 +08:00
add typing.AsyncContextManager and contextlib.asynccontextmanager (#1432)
Implements: - https://github.com/python/typing/pull/438 - https://github.com/python/cpython/pull/360 Note that https://github.com/python/cpython/pull/1412, which adds contextlib.AbstractAsyncContextManager, has not yet been merged.
This commit is contained in:
committed by
Guido van Rossum
parent
31d7393cae
commit
22f47fd478
@@ -291,6 +291,13 @@ class ContextManager(Generic[_T_co]):
|
||||
exc_value: Optional[BaseException],
|
||||
traceback: Optional[TracebackType]) -> Optional[bool]: ...
|
||||
|
||||
if sys.version_info >= (3, 5):
|
||||
class AsyncContextManager(Generic[_T_co]):
|
||||
def __aenter__(self) -> Awaitable[_T_co]: ...
|
||||
def __aexit__(self, exc_type: Optional[Type[BaseException]],
|
||||
exc_value: Optional[BaseException],
|
||||
traceback: Optional[TracebackType]) -> Awaitable[Optional[bool]]: ...
|
||||
|
||||
class Mapping(_Collection[_KT], Generic[_KT, _VT_co]):
|
||||
# TODO: We wish the key type could also be covariant, but that doesn't work,
|
||||
# see discussion in https: //github.com/python/typing/pull/273.
|
||||
|
||||
Reference in New Issue
Block a user