Skip to content

Commit 67d0c8e

Browse files
committed
Use PEP 695 syntax
1 parent 9ee231c commit 67d0c8e

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

Lib/typing.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3804,12 +3804,9 @@ def get_protocol_members(tp: type, /) -> frozenset[str]:
38043804
return frozenset(tp.__protocol_attrs__)
38053805

38063806

3807-
_P = ParamSpec("_P")
3808-
3809-
3810-
def copy_func_params(
3811-
source_func: Callable[_P, Any]
3812-
) -> Callable[[Callable[..., T]], Callable[_P, T]]:
3807+
def copy_func_params[**Param, RV](
3808+
source_func: Callable[Param, Any]
3809+
) -> Callable[[Callable[..., RV]], Callable[Param, RV]]:
38133810
"""Cast the decorated function's call signature to the source_func's.
38143811
38153812
Use this decorator enhancing an upstream function while keeping its
@@ -3836,8 +3833,8 @@ def enhanced(
38363833
*source_func* changes.
38373834
"""
38383835

3839-
def return_func(func: Callable[..., T]) -> Callable[_P, T]:
3840-
return cast(Callable[_P, T], func)
3836+
def return_func(func: Callable[..., RV]) -> Callable[Param, RV]:
3837+
return cast(Callable[Param, RV], func)
38413838

38423839
return return_func
38433840

0 commit comments

Comments
 (0)