|
26 | 26 | from typing import Sequence
|
27 | 27 | from typing import Tuple
|
28 | 28 | from typing import TYPE_CHECKING
|
29 |
| - from typing import TypedDict |
30 | 29 | from typing import TypeVar
|
31 | 30 | from typing import Union
|
32 | 31 |
|
|
42 | 41 | _HookImplFunction = Callable[..., Union[_T, Generator[None, Result[_T], None]]]
|
43 | 42 | _CallHistory = List[Tuple[Mapping[str, object], Optional[Callable[[Any], None]]]]
|
44 | 43 |
|
45 |
| - class HookspecOpts(TypedDict): |
46 |
| - """Options for a hook specification.""" |
47 |
| - |
48 |
| - #: Whether the hook is :ref:`first result only <firstresult>`. |
49 |
| - firstresult: bool |
50 |
| - #: Whether the hook is :ref:`historic <historic>`. |
51 |
| - historic: bool |
52 |
| - #: Whether the hook :ref:`warns when implemented <warn_on_impl>`. |
53 |
| - warn_on_impl: Warning | None |
54 |
| - #: Whether the hook warns when :ref:`certain arguments are requested |
55 |
| - #: <warn_on_impl>`. |
56 |
| - #: |
57 |
| - #: .. versionadded:: 1.5 |
58 |
| - warn_on_impl_args: Mapping[str, Warning] | None |
59 |
| - |
60 |
| - class HookimplOpts(TypedDict): |
61 |
| - """Options for a hook implementation.""" |
62 |
| - |
63 |
| - #: Whether the hook implementation is a :ref:`wrapper <hookwrapper>`. |
64 |
| - wrapper: bool |
65 |
| - #: Whether the hook implementation is an :ref:`old-style wrapper |
66 |
| - #: <old_style_hookwrappers>`. |
67 |
| - hookwrapper: bool |
68 |
| - #: Whether validation against a hook specification is :ref:`optional |
69 |
| - #: <optionalhook>`. |
70 |
| - optionalhook: bool |
71 |
| - #: Whether to try to order this hook implementation :ref:`first |
72 |
| - #: <callorder>`. |
73 |
| - tryfirst: bool |
74 |
| - #: Whether to try to order this hook implementation :ref:`last |
75 |
| - #: <callorder>`. |
76 |
| - trylast: bool |
77 |
| - #: The name of the hook specification to match, see :ref:`specname`. |
78 |
| - specname: str | None |
79 |
| - |
| 44 | + from ._types import HookimplOpts |
| 45 | + from ._types import HookspecOpts |
80 | 46 | else:
|
81 | 47 |
|
82 | 48 | def final(func: _F) -> _F:
|
@@ -382,8 +348,6 @@ def __init__(self) -> None:
|
382 | 348 |
|
383 | 349 | def __getattr__(self, name: str) -> HookCaller: ...
|
384 | 350 |
|
385 |
| - _CallHistory = List[Tuple[Mapping[str, object], Optional[Callable[[Any], None]]]] |
386 |
| - |
387 | 351 |
|
388 | 352 | # Historical name (pluggy<=1.2), kept for backward compatibility.
|
389 | 353 | _HookRelay = HookRelay
|
|
0 commit comments