File tree 1 file changed +6
-6
lines changed
1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change 1
1
import sys
2
2
from typing import Any , Protocol , TypeVar
3
- from typing_extensions import Self
3
+ from typing_extensions import ParamSpec , Self
4
4
5
- __all__ = ["Error" , "copy" , "deepcopy" , "replace" ]
5
+ __all__ = ["Error" , "copy" , "deepcopy" ]
6
6
7
7
_T = TypeVar ("_T" )
8
- _SR = TypeVar ("_SR" , bound = _SupportsReplace )
8
+ _SR = TypeVar ("_SR" , bound = _SupportsReplace [Any ])
9
+ _P = ParamSpec ("_P" )
9
10
10
- class _SupportsReplace (Protocol ):
11
+ class _SupportsReplace (Protocol [ _P ] ):
11
12
# In reality doesn't support args, but there's no other great way to express this.
12
- def __replace__ (self , * args : Any , ** kwargs : Any ) -> Self : ...
13
+ def __replace__ (self : Self , * args : _P . args , ** kwargs : _P . kwargs ) -> Self : ...
13
14
14
15
# None in CPython but non-None in Jython
15
16
PyStringMap : Any
@@ -20,7 +21,6 @@ def copy(x: _T) -> _T: ...
20
21
21
22
if sys .version_info >= (3 , 13 ):
22
23
def replace (obj : _SR , / , ** changes : Any ) -> _SR : ...
23
- __all__ += ["replace" ]
24
24
25
25
class Error (Exception ): ...
26
26
You can’t perform that action at this time.
0 commit comments