18
18
# error: No library stub file for module 'pandas._libs.properties'
19
19
from pandas ._libs .properties import cache_readonly # type: ignore # noqa
20
20
21
- FuncType = Callable [..., Any ]
22
- F = TypeVar ("F " , bound = FuncType )
21
+ _FuncType = Callable [..., Any ]
22
+ _F = TypeVar ("_F " , bound = _FuncType )
23
23
24
24
25
25
def deprecate (
@@ -107,7 +107,7 @@ def deprecate_kwarg(
107
107
new_arg_name : Optional [str ],
108
108
mapping : Optional [Union [Dict [Any , Any ], Callable [[Any ], Any ]]] = None ,
109
109
stacklevel : int = 2 ,
110
- ) -> Callable [..., Any ]:
110
+ ) -> Callable [[ _F ], _F ]:
111
111
"""
112
112
Decorator to deprecate a keyword argument of a function.
113
113
@@ -175,7 +175,7 @@ def deprecate_kwarg(
175
175
"mapping from old to new argument values " "must be dict or callable!"
176
176
)
177
177
178
- def _deprecate_kwarg (func : F ) -> F :
178
+ def _deprecate_kwarg (func : _F ) -> _F :
179
179
@wraps (func )
180
180
def wrapper (* args , ** kwargs ) -> Callable [..., Any ]:
181
181
old_arg_value = kwargs .pop (old_arg_name , None )
@@ -222,15 +222,15 @@ def wrapper(*args, **kwargs) -> Callable[..., Any]:
222
222
kwargs [new_arg_name ] = new_arg_value
223
223
return func (* args , ** kwargs )
224
224
225
- return cast (F , wrapper )
225
+ return cast (_F , wrapper )
226
226
227
227
return _deprecate_kwarg
228
228
229
229
230
230
def rewrite_axis_style_signature (
231
231
name : str , extra_params : List [Tuple [str , Any ]]
232
232
) -> Callable [..., Any ]:
233
- def decorate (func : F ) -> F :
233
+ def decorate (func : _F ) -> _F :
234
234
@wraps (func )
235
235
def wrapper (* args , ** kwargs ) -> Callable [..., Any ]:
236
236
return func (* args , ** kwargs )
@@ -251,7 +251,7 @@ def wrapper(*args, **kwargs) -> Callable[..., Any]:
251
251
252
252
# https://github.com/python/typing/issues/598
253
253
func .__signature__ = sig # type: ignore
254
- return cast (F , wrapper )
254
+ return cast (_F , wrapper )
255
255
256
256
return decorate
257
257
@@ -295,7 +295,7 @@ def __init__(self, *args, **kwargs):
295
295
296
296
self .params = args or kwargs
297
297
298
- def __call__ (self , func : F ) -> F :
298
+ def __call__ (self , func : _F ) -> _F :
299
299
func .__doc__ = func .__doc__ and func .__doc__ % self .params
300
300
return func
301
301
@@ -335,7 +335,7 @@ def __init__(self, addendum: Optional[str], join: str = "", indents: int = 0):
335
335
self .addendum = addendum
336
336
self .join = join
337
337
338
- def __call__ (self , func : F ) -> F :
338
+ def __call__ (self , func : _F ) -> _F :
339
339
func .__doc__ = func .__doc__ if func .__doc__ else ""
340
340
self .addendum = self .addendum if self .addendum else ""
341
341
docitems = [func .__doc__ , self .addendum ]
0 commit comments