|
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 |
22 | 21 | from typing import TypeVar |
23 | | -from typing import Union |
24 | 22 | import warnings |
25 | 23 |
|
26 | 24 | from ._result import Result |
27 | 25 |
|
28 | 26 |
|
29 | 27 | _T = TypeVar("_T") |
30 | 28 | _F = TypeVar("_F", bound=Callable[..., object]) |
31 | | -_Namespace = Union[ModuleType, type] |
| 29 | +_Namespace = ModuleType | type |
32 | 30 | _Plugin = object |
33 | 31 | _HookExec = Callable[ |
34 | 32 | [str, Sequence["HookImpl"], Mapping[str, object], bool], |
35 | | - Union[object, list[object]], |
| 33 | + object | list[object], |
36 | 34 | ] |
37 | | -_HookImplFunction = Callable[..., Union[_T, Generator[None, Result[_T], None]]] |
| 35 | +_HookImplFunction = Callable[..., _T | Generator[None, Result[_T], None]] |
38 | 36 |
|
39 | 37 |
|
40 | 38 | class HookspecOpts(TypedDict): |
@@ -374,7 +372,7 @@ def __getattr__(self, name: str) -> HookCaller: ... |
374 | 372 | _HookRelay = HookRelay |
375 | 373 |
|
376 | 374 |
|
377 | | -_CallHistory = list[tuple[Mapping[str, object], Optional[Callable[[Any], None]]]] |
| 375 | +_CallHistory = list[tuple[Mapping[str, object], Callable[[Any], None] | None]] |
378 | 376 |
|
379 | 377 |
|
380 | 378 | class HookCaller: |
|
0 commit comments