37
37
_HookImplFunction = Callable [..., Union [_T , Generator [None , Result [_T ], None ]]]
38
38
39
39
40
- class HookSpecOpts (TypedDict ):
40
+ class HookspecOpts (TypedDict ):
41
41
"""Options for a hook specification."""
42
42
43
43
#: Whether the hook is :ref:`first result only <firstresult>`.
@@ -48,7 +48,7 @@ class HookSpecOpts(TypedDict):
48
48
warn_on_impl : Warning | None
49
49
50
50
51
- class HookImplOpts (TypedDict ):
51
+ class HookimplOpts (TypedDict ):
52
52
"""Options for a hook implementation."""
53
53
54
54
#: Whether the hook implementation is a :ref:`wrapper <hookwrapper>`.
@@ -132,7 +132,7 @@ def __call__( # noqa: F811
132
132
def setattr_hookspec_opts (func : _F ) -> _F :
133
133
if historic and firstresult :
134
134
raise ValueError ("cannot have a historic firstresult hook" )
135
- opts : HookSpecOpts = {
135
+ opts : HookspecOpts = {
136
136
"firstresult" : firstresult ,
137
137
"historic" : historic ,
138
138
"warn_on_impl" : warn_on_impl ,
@@ -247,7 +247,7 @@ def __call__( # noqa: F811
247
247
"""
248
248
249
249
def setattr_hookimpl_opts (func : _F ) -> _F :
250
- opts : HookImplOpts = {
250
+ opts : HookimplOpts = {
251
251
"wrapper" : wrapper ,
252
252
"hookwrapper" : hookwrapper ,
253
253
"optionalhook" : optionalhook ,
@@ -264,7 +264,7 @@ def setattr_hookimpl_opts(func: _F) -> _F:
264
264
return setattr_hookimpl_opts (function )
265
265
266
266
267
- def normalize_hookimpl_opts (opts : HookImplOpts ) -> None :
267
+ def normalize_hookimpl_opts (opts : HookimplOpts ) -> None :
268
268
opts .setdefault ("tryfirst" , False )
269
269
opts .setdefault ("trylast" , False )
270
270
opts .setdefault ("wrapper" , False )
@@ -379,7 +379,7 @@ def __init__(
379
379
name : str ,
380
380
hook_execute : _HookExec ,
381
381
specmodule_or_class : _Namespace | None = None ,
382
- spec_opts : HookSpecOpts | None = None ,
382
+ spec_opts : HookspecOpts | None = None ,
383
383
) -> None :
384
384
""":meta private:"""
385
385
self .name : Final = name
@@ -399,7 +399,7 @@ def has_spec(self) -> bool:
399
399
def set_specification (
400
400
self ,
401
401
specmodule_or_class : _Namespace ,
402
- spec_opts : HookSpecOpts ,
402
+ spec_opts : HookspecOpts ,
403
403
) -> None :
404
404
if self .spec is not None :
405
405
raise ValueError (
@@ -522,7 +522,7 @@ def call_extra(
522
522
not self .is_historic ()
523
523
), "Cannot directly call a historic hook - use call_historic instead."
524
524
self ._verify_all_args_are_provided (kwargs )
525
- opts : HookImplOpts = {
525
+ opts : HookimplOpts = {
526
526
"wrapper" : False ,
527
527
"hookwrapper" : False ,
528
528
"optionalhook" : False ,
@@ -626,7 +626,7 @@ def __init__(
626
626
plugin : _Plugin ,
627
627
plugin_name : str ,
628
628
function : _HookImplFunction [object ],
629
- hook_impl_opts : HookImplOpts ,
629
+ hook_impl_opts : HookimplOpts ,
630
630
) -> None :
631
631
self .function : Final = function
632
632
self .argnames , self .kwargnames = varnames (self .function )
@@ -654,7 +654,7 @@ class HookSpec:
654
654
"warn_on_impl" ,
655
655
)
656
656
657
- def __init__ (self , namespace : _Namespace , name : str , opts : HookSpecOpts ) -> None :
657
+ def __init__ (self , namespace : _Namespace , name : str , opts : HookspecOpts ) -> None :
658
658
self .namespace = namespace
659
659
self .function : Callable [..., object ] = getattr (namespace , name )
660
660
self .name = name
0 commit comments