2121else :
2222 from typing_extensions import ParamSpec
2323
24- R = TypeVar ("R " )
25- P = ParamSpec ("P " )
24+ _R = TypeVar ("_R " )
25+ _P = ParamSpec ("_P " )
2626
2727
2828@wrapt .decorator
@@ -153,7 +153,7 @@ def raise_if_nothing_inferred(func, instance, args, kwargs):
153153
154154 def deprecate_default_argument_values (
155155 astroid_version : str = "3.0" , ** arguments : str
156- ) -> Callable [[Callable [P , R ]], Callable [P , R ]]:
156+ ) -> Callable [[Callable [_P , _R ]], Callable [_P , _R ]]:
157157 """Decorator which emits a DeprecationWarning if any arguments specified
158158 are None or not passed at all.
159159
@@ -167,11 +167,11 @@ def deprecate_default_argument_values(
167167 # Decorator for DeprecationWarning: https://stackoverflow.com/a/49802489
168168 # Typing of stacked decorators: https://stackoverflow.com/a/68290080
169169
170- def deco (func : Callable [P , R ]) -> Callable [P , R ]:
170+ def deco (func : Callable [_P , _R ]) -> Callable [_P , _R ]:
171171 """Decorator function."""
172172
173173 @functools .wraps (func )
174- def wrapper (* args : P .args , ** kwargs : P .kwargs ) -> R :
174+ def wrapper (* args : _P .args , ** kwargs : _P .kwargs ) -> _R :
175175 """Emit DeprecationWarnings if conditions are met."""
176176
177177 keys = list (inspect .signature (func ).parameters .keys ())
@@ -212,7 +212,7 @@ def wrapper(*args: P.args, **kwargs: P.kwargs) -> R:
212212
213213 def deprecate_arguments (
214214 astroid_version : str = "3.0" , ** arguments : str
215- ) -> Callable [[Callable [P , R ]], Callable [P , R ]]:
215+ ) -> Callable [[Callable [_P , _R ]], Callable [_P , _R ]]:
216216 """Decorator which emits a DeprecationWarning if any arguments specified
217217 are passed.
218218
@@ -223,9 +223,9 @@ def deprecate_arguments(
223223 the default one are enabled.
224224 """
225225
226- def deco (func : Callable [P , R ]) -> Callable [P , R ]:
226+ def deco (func : Callable [_P , _R ]) -> Callable [_P , _R ]:
227227 @functools .wraps (func )
228- def wrapper (* args : P .args , ** kwargs : P .kwargs ) -> R :
228+ def wrapper (* args : _P .args , ** kwargs : _P .kwargs ) -> _R :
229229
230230 keys = list (inspect .signature (func ).parameters .keys ())
231231 for arg , note in arguments .items ():
@@ -252,21 +252,21 @@ def wrapper(*args: P.args, **kwargs: P.kwargs) -> R:
252252
253253 def deprecate_default_argument_values (
254254 astroid_version : str = "3.0" , ** arguments : str
255- ) -> Callable [[Callable [P , R ]], Callable [P , R ]]:
255+ ) -> Callable [[Callable [_P , _R ]], Callable [_P , _R ]]:
256256 """Passthrough decorator to improve performance if DeprecationWarnings are disabled."""
257257
258- def deco (func : Callable [P , R ]) -> Callable [P , R ]:
258+ def deco (func : Callable [_P , _R ]) -> Callable [_P , _R ]:
259259 """Decorator function."""
260260 return func
261261
262262 return deco
263263
264264 def deprecate_arguments (
265265 astroid_version : str = "3.0" , ** arguments : str
266- ) -> Callable [[Callable [P , R ]], Callable [P , R ]]:
266+ ) -> Callable [[Callable [_P , _R ]], Callable [_P , _R ]]:
267267 """Passthrough decorator to improve performance if DeprecationWarnings are disabled."""
268268
269- def deco (func : Callable [P , R ]) -> Callable [P , R ]:
269+ def deco (func : Callable [_P , _R ]) -> Callable [_P , _R ]:
270270 """Decorator function."""
271271 return func
272272
0 commit comments