@@ -4,7 +4,7 @@ from typing import (
4
4
Literal as L ,
5
5
Protocol ,
6
6
SupportsIndex as CanIndex ,
7
- SupportsInt ,
7
+ SupportsInt as CanInt ,
8
8
TypeAlias ,
9
9
overload ,
10
10
type_check_only ,
@@ -50,27 +50,26 @@ from _numtype import (
50
50
from numpy ._typing import _NestedSequence , _NumberLike_co
51
51
52
52
_T = TypeVar ("_T" )
53
- _T_contra = TypeVar ("_T_contra" , contravariant = True , default = Any )
54
53
_CoefT = TypeVar ("_CoefT" , bound = np .number | np .bool | np .object_ )
55
54
_NameT_co = TypeVar ("_NameT_co" , bound = str , default = LiteralString , covariant = True )
56
55
57
56
# compatible with e.g. int, float, complex, Decimal, Fraction, and ABCPolyBase
58
57
@type_check_only
59
- class _SupportsCoefOps (Protocol [ _T_contra ] ):
58
+ class _SupportsCoefOps (Protocol ):
60
59
def __eq__ (self , x : object , / ) -> bool : ...
61
60
def __ne__ (self , x : object , / ) -> bool : ...
62
61
def __neg__ (self , / ) -> Self : ...
63
62
def __pos__ (self , / ) -> Self : ...
64
- def __add__ (self , x : _T_contra , / ) -> Self : ...
65
- def __sub__ (self , x : _T_contra , / ) -> Self : ...
66
- def __mul__ (self , x : _T_contra , / ) -> Self : ...
67
- def __pow__ (self , x : _T_contra , / ) -> Self | float : ...
68
- def __radd__ (self , x : _T_contra , / ) -> Self : ...
69
- def __rsub__ (self , x : _T_contra , / ) -> Self : ...
70
- def __rmul__ (self , x : _T_contra , / ) -> Self : ...
63
+ def __add__ (self , x : Any , / ) -> Self : ...
64
+ def __sub__ (self , x : Any , / ) -> Self : ...
65
+ def __mul__ (self , x : Any , / ) -> Self : ...
66
+ def __pow__ (self , x : Any , / ) -> Self | float : ...
67
+ def __radd__ (self , x : Any , / ) -> Self : ...
68
+ def __rsub__ (self , x : Any , / ) -> Self : ...
69
+ def __rmul__ (self , x : Any , / ) -> Self : ...
71
70
72
71
_Tuple2 : TypeAlias = tuple [_T , _T ]
73
- _ToInt : TypeAlias = SupportsInt | CanIndex
72
+ _ToInt : TypeAlias = CanInt | CanIndex
74
73
75
74
_InexactObject_1d : TypeAlias = Array_1d [np .inexact | np .object_ ]
76
75
_InexactObject_nd : TypeAlias = Array [np .inexact | np .object_ ]
@@ -85,6 +84,11 @@ _ToNumeric_nd: TypeAlias = _ToArray_nd[np.number | np.bool | np.object_, complex
85
84
_ToValF : TypeAlias = Callable [[Array [Any ], Array [Any ], bool ], _ToNumeric_nd ]
86
85
_ToVanderF : TypeAlias = Callable [[Array [Any ], int ], _ToNumericObject_nd ]
87
86
87
+ _Indices : TypeAlias = Sequence [CanIndex ]
88
+
89
+ _FullFitResult : TypeAlias = Sequence [np .inexact | np .int32 ]
90
+ _ArrayAndFitResult : TypeAlias = tuple [Array [_CoefT ], _FullFitResult ]
91
+
88
92
@type_check_only
89
93
class _HasName (Protocol [_NameT_co ]):
90
94
@property
@@ -396,8 +400,6 @@ class _FuncVander(_HasName[_NameT_co], Protocol[_NameT_co]):
396
400
@overload
397
401
def __call__ (self , / , x : npt .ArrayLike , deg : CanIndex ) -> Array [Any ]: ...
398
402
399
- _Indices : TypeAlias = Sequence [CanIndex ]
400
-
401
403
@type_check_only
402
404
class _FuncVander2D (_HasName [_NameT_co ], Protocol [_NameT_co ]):
403
405
@overload
@@ -469,8 +471,6 @@ class _FuncVanderND(_HasName[_NameT_co], Protocol[_NameT_co]):
469
471
degrees : Sequence [CanIndex ],
470
472
) -> Array [Any ]: ...
471
473
472
- _FullFitResult : TypeAlias = Sequence [np .inexact | np .int32 ]
473
-
474
474
@type_check_only
475
475
class _FuncFit (_HasName [_NameT_co ], Protocol [_NameT_co ]):
476
476
@overload
0 commit comments