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