Skip to content

Commit af376f4

Browse files
authored
Add contextlib.AsyncContextDecorator (#5550)
1 parent 33ea648 commit af376f4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

stdlib/contextlib.pyi

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ from typing import (
55
Any,
66
AsyncContextManager,
77
AsyncIterator,
8+
Awaitable,
89
Callable,
910
ContextManager,
1011
Iterator,
@@ -49,6 +50,9 @@ if sys.version_info >= (3, 10):
4950
_SupportsAcloseT = TypeVar("_SupportsAcloseT", bound=_SupportsAclose)
5051
class aclosing(AsyncContextManager[_SupportsAcloseT]):
5152
def __init__(self, thing: _SupportsAcloseT) -> None: ...
53+
_AF = TypeVar("_AF", bound=Callable[..., Awaitable[Any]])
54+
class AsyncContextDecorator:
55+
def __call__(self, func: _AF) -> _AF: ...
5256

5357
class suppress(ContextManager[None]):
5458
def __init__(self, *exceptions: Type[BaseException]) -> None: ...
@@ -83,8 +87,6 @@ class ExitStack(ContextManager[ExitStack]):
8387
) -> bool: ...
8488

8589
if sys.version_info >= (3, 7):
86-
from typing import Awaitable
87-
8890
_S = TypeVar("_S", bound=AsyncExitStack)
8991

9092
_ExitCoroFunc = Callable[[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]], Awaitable[bool]]

0 commit comments

Comments
 (0)