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 5
5
from threading import Event
6
6
from typing import (
7
7
TYPE_CHECKING ,
8
+ Any ,
8
9
AsyncGenerator ,
9
10
Awaitable ,
10
11
Callable ,
21
22
"generator_to_async_generator" ,
22
23
]
23
24
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 ])
34
26
35
27
36
28
@asynccontextmanager
37
29
async def aclosing (
38
- thing : "_SupportsAcloseT" ,
39
- ) -> AsyncGenerator ["_SupportsAcloseT" , None ]:
30
+ thing : _T_Generator ,
31
+ ) -> AsyncGenerator [_T_Generator , None ]:
40
32
"Similar to `contextlib.aclosing`, in Python 3.10."
41
33
try :
42
34
yield thing
You can’t perform that action at this time.
0 commit comments