@@ -10,56 +10,57 @@ except ImportError:
1010from decopatch .utils_disambiguation import FirstArgDisambiguation
1111from decopatch .utils_modes import SignatureInfo
1212
13- P = ParamSpec ("P" )
14- F = TypeVar ("F" , bound = Callable [..., Any ])
13+ _P = ParamSpec ("_P" )
14+ _F = TypeVar ("_F" , bound = Callable [..., Any ])
15+ _CustomDisambugatorT = Optional [Callable [[Any ], FirstArgDisambiguation ]]
1516
16- class _Decorator (Protocol [P ]):
17+ class _Decorator (Protocol [_P ]):
1718 """
1819 This is callable Protocol, to distinguish between cases where
1920 created decorator is called as `@decorator` or `@decorator()`
2021 """
2122
2223 # decorator is called without parenthesis: @decorator
2324 @overload
24- def __call__ (self , func : F ) -> F : ...
25+ def __call__ (self , func : _F ) -> _F : ...
2526 # decorator is called with options or parenthesis: @decorator(some_option=...)
2627 @overload
27- def __call__ (self , * args : P .args , ** kwargs : P .kwargs ) -> Callable [[F ], F ]: ...
28+ def __call__ (self , * args : _P .args , ** kwargs : _P .kwargs ) -> Callable [[_F ], _F ]: ...
2829
2930# @function_decorator is called without options or parenthesis
3031@overload
3132def function_decorator (
32- enable_stack_introspection : Callable [P , Any ],
33- custom_disambiguator : Callable [[ Any ], FirstArgDisambiguation ] = ...,
33+ enable_stack_introspection : Callable [_P , Any ],
34+ custom_disambiguator : _CustomDisambugatorT = ...,
3435 flat_mode_decorated_name : Optional [str ] = ...,
35- ) -> _Decorator [P ]: ...
36+ ) -> _Decorator [_P ]: ...
3637
3738# @function_decorator() is called with options or parenthesis.
3839@overload
3940def function_decorator (
4041 enable_stack_introspection : bool = ...,
41- custom_disambiguator : Callable [[ Any ], FirstArgDisambiguation ] = ...,
42+ custom_disambiguator : _CustomDisambugatorT = ...,
4243 flat_mode_decorated_name : Optional [str ] = ...,
43- ) -> Callable [[Callable [P , Any ]], _Decorator [P ]]: ...
44+ ) -> Callable [[Callable [_P , Any ]], _Decorator [_P ]]: ...
4445def class_decorator (
4546 enable_stack_introspection : bool = ...,
46- custom_disambiguator : Callable [[ Any ], FirstArgDisambiguation ] = ...,
47+ custom_disambiguator : _CustomDisambugatorT = ...,
4748 flat_mode_decorated_name : Optional [str ] = ...,
4849): ...
4950def decorator (
5051 is_function_decorator : bool = ...,
5152 is_class_decorator : bool = ...,
5253 enable_stack_introspection : bool = ...,
53- custom_disambiguator : Callable [[ Any ], FirstArgDisambiguation ] = ...,
54+ custom_disambiguator : _CustomDisambugatorT = ...,
5455 use_signature_trick : bool = ...,
55- flat_mode_decorated_name : str = ...,
56+ flat_mode_decorated_name : Optional [ str ] = ...,
5657): ...
5758def create_decorator (
5859 impl_function ,
5960 is_function_decorator : bool = ...,
6061 is_class_decorator : bool = ...,
6162 enable_stack_introspection : bool = ...,
62- custom_disambiguator : Callable [[ Any ], FirstArgDisambiguation ] = ...,
63+ custom_disambiguator : _CustomDisambugatorT = ...,
6364 use_signature_trick : bool = ...,
6465 flat_mode_decorated_name : Optional [str ] = ...,
6566): ...
0 commit comments