|
4 | 4 |
|
5 | 5 | from __future__ import annotations |
6 | 6 |
|
| 7 | +from collections.abc import Callable |
7 | 8 | from collections.abc import Generator |
8 | 9 | from collections.abc import Mapping |
9 | 10 | from collections.abc import Sequence |
|
12 | 13 | import sys |
13 | 14 | from types import ModuleType |
14 | 15 | from typing import Any |
15 | | -from typing import Callable |
16 | 16 | from typing import Final |
17 | 17 | from typing import final |
18 | | -from typing import Optional |
19 | 18 | from typing import overload |
20 | 19 | from typing import TYPE_CHECKING |
21 | 20 | from typing import TypedDict |
|
32 | 31 | _Plugin = object |
33 | 32 | _HookExec = Callable[ |
34 | 33 | [str, Sequence["HookImpl"], Mapping[str, object], bool], |
35 | | - Union[object, list[object]], |
| 34 | + object | list[object], |
36 | 35 | ] |
37 | | -_HookImplFunction = Callable[..., Union[_T, Generator[None, Result[_T], None]]] |
| 36 | +_HookImplFunction = Callable[..., _T | Generator[None, Result[_T], None]] |
38 | 37 |
|
39 | 38 |
|
40 | 39 | class HookspecOpts(TypedDict): |
@@ -374,7 +373,7 @@ def __getattr__(self, name: str) -> HookCaller: ... |
374 | 373 | _HookRelay = HookRelay |
375 | 374 |
|
376 | 375 |
|
377 | | -_CallHistory = list[tuple[Mapping[str, object], Optional[Callable[[Any], None]]]] |
| 376 | +_CallHistory = list[tuple[Mapping[str, object], Callable[[Any], None] | None]] |
378 | 377 |
|
379 | 378 |
|
380 | 379 | class HookCaller: |
|
0 commit comments