File tree Expand file tree Collapse file tree 1 file changed +4
-12
lines changed
src/prompt_toolkit/eventloop Expand file tree Collapse file tree 1 file changed +4
-12
lines changed Original file line number Diff line number Diff line change 55from threading import Event
66from typing import (
77 TYPE_CHECKING ,
8+ Any ,
89 AsyncGenerator ,
910 Awaitable ,
1011 Callable ,
2122 "generator_to_async_generator" ,
2223]
2324
24-
25- if TYPE_CHECKING :
26- # Thanks: https://github.com/python/typeshed/blob/main/stdlib/contextlib.pyi
27- from typing_extensions import Protocol
28-
29- class _SupportsAclose (Protocol ):
30- def aclose (self ) -> Awaitable [object ]:
31- ...
32-
33- _SupportsAcloseT = TypeVar ("_SupportsAcloseT" , bound = _SupportsAclose )
25+ _T_Generator = TypeVar ("_T_Generator" , bound = AsyncGenerator [Any , None ])
3426
3527
3628@asynccontextmanager
3729async def aclosing (
38- thing : "_SupportsAcloseT" ,
39- ) -> AsyncGenerator ["_SupportsAcloseT" , None ]:
30+ thing : _T_Generator ,
31+ ) -> AsyncGenerator [_T_Generator , None ]:
4032 "Similar to `contextlib.aclosing`, in Python 3.10."
4133 try :
4234 yield thing
You can’t perform that action at this time.
0 commit comments