@@ -619,7 +619,7 @@ _RealT_co = TypeVar("_RealT_co", covariant=True)
619
619
_ImagT_co = TypeVar ("_ImagT_co" , covariant = True )
620
620
621
621
_DTypeT = TypeVar ("_DTypeT" , bound = dtype )
622
- _DTypeT_co = TypeVar ("_DTypeT_co" , bound = dtype , covariant = True )
622
+ _DTypeT_co = TypeVar ("_DTypeT_co" , bound = dtype , default = dtype , covariant = True )
623
623
_FlexDTypeT = TypeVar ("_FlexDTypeT" , bound = dtype [flexible ])
624
624
625
625
_ArrayT = TypeVar ("_ArrayT" , bound = _nt .Array )
@@ -628,6 +628,7 @@ _NumericArrayT = TypeVar("_NumericArrayT", bound=_nt.Array[number | timedelta64
628
628
629
629
_ShapeT = TypeVar ("_ShapeT" , bound = _nt .Shape )
630
630
_ShapeT_co = TypeVar ("_ShapeT_co" , bound = _nt .Shape , covariant = True )
631
+ _ShapeT0_co = TypeVar ("_ShapeT0_co" , bound = _nt .Shape , default = _nt .Shape , covariant = True )
631
632
_Shape1NDT = TypeVar ("_Shape1NDT" , bound = _nt .Shape1N )
632
633
633
634
_ScalarT = TypeVar ("_ScalarT" , bound = generic )
@@ -998,9 +999,11 @@ _HasTypeWithReal: TypeAlias = _HasType[_HasReal[_T]]
998
999
_HasTypeWithImag : TypeAlias = _HasType [_HasImag [_T ]]
999
1000
1000
1001
@type_check_only
1001
- class _HasDType (Protocol [_T_co ]):
1002
+ class _HasDType (Protocol [_T_co , _ShapeT0_co ]):
1002
1003
@property
1003
1004
def dtype (self , / ) -> _T_co : ...
1005
+ @property
1006
+ def shape (self , / ) -> _ShapeT0_co : ...
1004
1007
1005
1008
_HasDTypeWithItem : TypeAlias = _HasDType [_HasTypeWithItem [_T ]]
1006
1009
_HasDTypeWithReal : TypeAlias = _HasDType [_HasTypeWithReal [_T ]]
@@ -2117,16 +2120,16 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DTypeT_co]):
2117
2120
def __ge__ (self , other : _ArrayLikeObject_co , / ) -> _nt .Array [bool_ ]: ...
2118
2121
2119
2122
#
2120
- def __abs__ (self : _HasDType [_HasType [SupportsAbs [_ScalarT ]]], / ) -> _nt .Array [_ScalarT , _ShapeT_co ]: ...
2123
+ def __abs__ (self : _HasDType [_HasType [SupportsAbs [_ScalarT ]], _ShapeT ], / ) -> _nt .Array [_ScalarT , _ShapeT ]: ...
2121
2124
def __neg__ (self : _NumericArrayT , / ) -> _NumericArrayT : ... # noqa: PYI019
2122
2125
def __pos__ (self : _NumericArrayT , / ) -> _NumericArrayT : ... # noqa: PYI019
2123
2126
def __invert__ (self : _IntegralArrayT , / ) -> _IntegralArrayT : ... # noqa: PYI019
2124
2127
2125
2128
#
2126
2129
@overload
2127
- def __add__ (self : _nt .Array [_ScalarT ], x : _nt .Casts [_ScalarT ], / ) -> _nt .Array [_ScalarT ]: ... # type: ignore[overload-overlap]
2130
+ def __add__ (self : _nt .Array [_ScalarT ], x : _nt .Casts [_ScalarT ], / ) -> _nt .Array [_ScalarT ]: ...
2128
2131
@overload
2129
- def __add__ (self : _nt .Array [_SelfScalarT ], x : _nt .CastsWith [_SelfScalarT , _ScalarT ], / ) -> _nt .Array [_ScalarT ]: ... # type: ignore[overload-overlap]
2132
+ def __add__ (self : _nt .Array [_SelfScalarT ], x : _nt .CastsWith [_SelfScalarT , _ScalarT ], / ) -> _nt .Array [_ScalarT ]: ...
2130
2133
@overload
2131
2134
def __add__ (self : _nt .CastsWithBuiltin [_T , _ScalarT ], x : _nt .SequenceND [_T ], / ) -> _nt .Array [_ScalarT ]: ...
2132
2135
@overload
@@ -2138,21 +2141,21 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DTypeT_co]):
2138
2141
@overload
2139
2142
def __add__ (self : _nt .Array [datetime64 ], x : _nt .CoTimeDelta_nd , / ) -> _nt .Array [datetime64 ]: ...
2140
2143
@overload
2141
- def __add__ (self : _nt .Array [_nt .co_timedelta ], x : _nt .ToDateTime_nd , / ) -> _nt .Array [datetime64 ]: ...
2144
+ def __add__ (self : _nt .Array [_nt .co_timedelta , Any ], x : _nt .ToDateTime_nd , / ) -> _nt .Array [datetime64 ]: ...
2142
2145
@overload
2143
- def __add__ (self : _nt .Array [object_ ], x : object , / ) -> _nt .Array [object_ ]: ... # type: ignore[overload-cannot-match]
2146
+ def __add__ (self : _nt .Array [object_ , Any ], x : object , / ) -> _nt .Array [object_ ]: ...
2144
2147
@overload
2145
- def __add__ (self : _nt .Array [str_ ], x : _nt .ToString_nd [_T ], / ) -> _nt .StringArrayND [_T ]: ...
2148
+ def __add__ (self : _nt .Array [str_ , Any ], x : _nt .ToString_nd [_T ], / ) -> _nt .StringArrayND [_T ]: ...
2146
2149
@overload
2147
2150
def __add__ (self : _nt .StringArrayND [_T ], x : _nt .ToString_nd [_T ] | _nt .ToStr_nd , / ) -> _nt .StringArrayND [_T ]: ...
2148
2151
@overload
2149
2152
def __add__ (self : _nt .Array [generic [_T ]], x : _nt .Sequence1ND [_nt .op .CanRAdd [_T ]], / ) -> _nt .Array [Incomplete ]: ...
2150
2153
2151
2154
#
2152
2155
@overload
2153
- def __radd__ (self : _nt .Array [_ScalarT ], x : _nt .Casts [_ScalarT ], / ) -> _nt .Array [_ScalarT ]: ... # type: ignore[overload-overlap]
2156
+ def __radd__ (self : _nt .Array [_ScalarT ], x : _nt .Casts [_ScalarT ], / ) -> _nt .Array [_ScalarT ]: ...
2154
2157
@overload
2155
- def __radd__ (self : _nt .Array [_SelfScalarT ], x : _nt .CastsWith [_SelfScalarT , _ScalarT ], / ) -> _nt .Array [_ScalarT ]: ... # type: ignore[overload-overlap]
2158
+ def __radd__ (self : _nt .Array [_SelfScalarT ], x : _nt .CastsWith [_SelfScalarT , _ScalarT ], / ) -> _nt .Array [_ScalarT ]: ...
2156
2159
@overload
2157
2160
def __radd__ (self : _nt .CastsWithBuiltin [_T , _ScalarT ], x : _nt .SequenceND [_T ], / ) -> _nt .Array [_ScalarT ]: ...
2158
2161
@overload
@@ -2164,11 +2167,11 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DTypeT_co]):
2164
2167
@overload
2165
2168
def __radd__ (self : _nt .Array [datetime64 ], x : _nt .CoTimeDelta_nd , / ) -> _nt .Array [datetime64 ]: ...
2166
2169
@overload
2167
- def __radd__ (self : _nt .Array [_nt .co_timedelta ], x : _nt .ToDateTime_nd , / ) -> _nt .Array [datetime64 ]: ...
2170
+ def __radd__ (self : _nt .Array [_nt .co_timedelta , Any ], x : _nt .ToDateTime_nd , / ) -> _nt .Array [datetime64 ]: ...
2168
2171
@overload
2169
- def __radd__ (self : _nt .Array [object_ ], x : object , / ) -> _nt .Array [object_ ]: ... # type: ignore[overload-cannot-match]
2172
+ def __radd__ (self : _nt .Array [object_ , Any ], x : object , / ) -> _nt .Array [object_ ]: ...
2170
2173
@overload
2171
- def __radd__ (self : _nt .Array [str_ ], x : _nt .ToString_nd [_T ], / ) -> _nt .StringArrayND [_T ]: ...
2174
+ def __radd__ (self : _nt .Array [str_ , Any ], x : _nt .ToString_nd [_T ], / ) -> _nt .StringArrayND [_T ]: ...
2172
2175
@overload
2173
2176
def __radd__ (self : _nt .StringArrayND [_T ], x : _nt .ToString_nd [_T ] | _nt .ToStr_nd , / ) -> _nt .StringArrayND [_T ]: ...
2174
2177
@overload
@@ -2268,7 +2271,7 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DTypeT_co]):
2268
2271
@overload
2269
2272
def __mul__ (self : _nt .Array [_CoNumberT ], x : _nt .Casts [_CoNumberT ], / ) -> _nt .Array [_CoNumberT ]: ...
2270
2273
@overload
2271
- def __mul__ (self : _nt .Array [_SelfScalarT ], x : _nt .CastsWith [_SelfScalarT , _ScalarT ], / ) -> _nt .Array [_ScalarT ]: ... # type: ignore[overload-overlap]
2274
+ def __mul__ (self : _nt .Array [_SelfScalarT ], x : _nt .CastsWith [_SelfScalarT , _ScalarT ], / ) -> _nt .Array [_ScalarT ]: ...
2272
2275
@overload
2273
2276
def __mul__ (self : _nt .CastsWithBuiltin [_T , _ScalarT ], x : _nt .SequenceND [_T ], / ) -> _nt .Array [_ScalarT ]: ...
2274
2277
@overload
@@ -2278,11 +2281,11 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DTypeT_co]):
2278
2281
@overload
2279
2282
def __mul__ (self : _nt .CastsWithComplex [_ScalarT ], x : _PyComplexND , / ) -> _nt .Array [_ScalarT ]: ...
2280
2283
@overload
2281
- def __mul__ (self : _nt .Array [timedelta64 ], x : _nt .ToFloating_nd , / ) -> _nt .Array [timedelta64 ]: ...
2284
+ def __mul__ (self : _nt .Array [timedelta64 , Any ], x : _nt .ToFloating_nd , / ) -> _nt .Array [timedelta64 ]: ...
2282
2285
@overload
2283
- def __mul__ (self : _nt .Array [object_ ], x : object , / ) -> _nt .Array [object_ ]: ... # type: ignore[overload-cannot-match]
2286
+ def __mul__ (self : _nt .Array [object_ , Any ], x : object , / ) -> _nt .Array [object_ ]: ...
2284
2287
@overload
2285
- def __mul__ (self : _nt .Array [integer ], x : _nt .ToString_nd , / ) -> _nt .StringArrayND [_T ]: ...
2288
+ def __mul__ (self : _nt .Array [integer , Any ], x : _nt .ToString_nd , / ) -> _nt .StringArrayND [_T ]: ...
2286
2289
@overload
2287
2290
def __mul__ (self : _nt .StringArrayND [_T ], x : _nt .ToInteger_nd , / ) -> _nt .StringArrayND [_T ]: ...
2288
2291
@overload
@@ -2292,7 +2295,7 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DTypeT_co]):
2292
2295
@overload
2293
2296
def __rmul__ (self : _nt .Array [_CoNumberT ], x : _nt .Casts [_CoNumberT ], / ) -> _nt .Array [_CoNumberT ]: ...
2294
2297
@overload
2295
- def __rmul__ (self : _nt .Array [_SelfScalarT ], x : _nt .CastsWith [_SelfScalarT , _ScalarT ], / ) -> _nt .Array [_ScalarT ]: ... # type: ignore[overload-overlap]
2298
+ def __rmul__ (self : _nt .Array [_SelfScalarT ], x : _nt .CastsWith [_SelfScalarT , _ScalarT ], / ) -> _nt .Array [_ScalarT ]: ...
2296
2299
@overload
2297
2300
def __rmul__ (self : _nt .CastsWithBuiltin [_T , _ScalarT ], x : _nt .SequenceND [_T ], / ) -> _nt .Array [_ScalarT ]: ...
2298
2301
@overload
@@ -2302,11 +2305,11 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DTypeT_co]):
2302
2305
@overload
2303
2306
def __rmul__ (self : _nt .CastsWithComplex [_ScalarT ], x : _PyComplexND , / ) -> _nt .Array [_ScalarT ]: ...
2304
2307
@overload
2305
- def __rmul__ (self : _nt .Array [timedelta64 ], x : _nt .ToFloating_nd , / ) -> _nt .Array [timedelta64 ]: ...
2308
+ def __rmul__ (self : _nt .Array [timedelta64 , Any ], x : _nt .ToFloating_nd , / ) -> _nt .Array [timedelta64 ]: ...
2306
2309
@overload
2307
- def __rmul__ (self : _nt .Array [object_ ], x : object , / ) -> _nt .Array [object_ ]: ... # type: ignore[overload-cannot-match]
2310
+ def __rmul__ (self : _nt .Array [object_ , Any ], x : object , / ) -> _nt .Array [object_ ]: ...
2308
2311
@overload
2309
- def __rmul__ (self : _nt .Array [integer ], x : _nt .ToString_nd , / ) -> _nt .StringArrayND [_T ]: ...
2312
+ def __rmul__ (self : _nt .Array [integer , Any ], x : _nt .ToString_nd , / ) -> _nt .StringArrayND [_T ]: ...
2310
2313
@overload
2311
2314
def __rmul__ (self : _nt .StringArrayND [_T ], x : _nt .ToInteger_nd , / ) -> _nt .StringArrayND [_T ]: ...
2312
2315
@overload
@@ -2666,47 +2669,55 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DTypeT_co]):
2666
2669
2667
2670
#
2668
2671
@overload
2669
- def __divmod__ (self : _nt .Array [bool_ ], x : _nt .ToBool_nd , / ) -> _2Tuple [_nt .Array [int8 ]]: ...
2672
+ def __divmod__ (self : _nt .Array [bool_ , _nt . Shape ], x : _nt .ToBool_nd , / ) -> _2Tuple [_nt .Array [int8 ]]: ...
2670
2673
@overload
2671
2674
def __divmod__ (
2672
- self : _nt .Array [_RealNumberT ], x : _nt .Casts [_RealNumberT ] | _nt .ToBool_nd , /
2675
+ self : _nt .Array [_RealNumberT , _nt . Shape ], x : _nt .Casts [_RealNumberT , _nt . Shape ] | _nt .ToBool_nd , /
2673
2676
) -> _2Tuple [_nt .Array [_RealNumberT ]]: ...
2674
2677
@overload
2675
2678
def __divmod__ (
2676
- self : _nt .Array [_CoFloatingT ], x : _nt .CastsWith [_CoFloatingT , _RealScalarT ], /
2679
+ self : _nt .Array [_CoFloatingT , _nt . Shape ], x : _nt .CastsWith [_CoFloatingT , _RealScalarT , _nt . Shape ], /
2677
2680
) -> _2Tuple [_nt .Array [_RealScalarT ]]: ...
2678
2681
@overload
2679
- def __divmod__ (self : _nt .CastsWithInt [_RealScalarT ], x : _PyIntND , / ) -> _2Tuple [_nt .Array [_RealScalarT ]]: ...
2682
+ def __divmod__ (
2683
+ self : _nt .CastsWithInt [_RealScalarT , _nt .Shape ], x : _PyIntND , /
2684
+ ) -> _2Tuple [_nt .Array [_RealScalarT ]]: ...
2680
2685
@overload
2681
- def __divmod__ (self : _nt .CastsWithFloat [_RealScalarT ], x : _PyFloatND , / ) -> _2Tuple [_nt .Array [_RealScalarT ]]: ...
2686
+ def __divmod__ (
2687
+ self : _nt .CastsWithFloat [_RealScalarT , _nt .Shape ], x : _PyFloatND , /
2688
+ ) -> _2Tuple [_nt .Array [_RealScalarT ]]: ...
2682
2689
@overload
2683
2690
def __divmod__ (
2684
- self : _nt .Array [timedelta64 ], x : _nt .ToTimeDelta_nd , /
2691
+ self : _nt .Array [timedelta64 , _nt . Shape ], x : _nt .ToTimeDelta_nd , /
2685
2692
) -> tuple [_nt .Array [int64 ], _nt .Array [timedelta64 ]]: ...
2686
2693
@overload
2687
- def __divmod__ (self : _nt .Array [object_ ], x : object , / ) -> _2Tuple [_nt .Array [object_ ]]: ...
2694
+ def __divmod__ (self : _nt .Array [object_ , _nt . Shape ], x : object , / ) -> _2Tuple [_nt .Array [object_ ]]: ...
2688
2695
2689
2696
#
2690
2697
@overload
2691
- def __rdivmod__ (self : _nt .Array [bool_ ], x : _nt .ToBool_nd , / ) -> _2Tuple [_nt .Array [int8 ]]: ...
2698
+ def __rdivmod__ (self : _nt .Array [bool_ , _nt . Shape ], x : _nt .ToBool_nd , / ) -> _2Tuple [_nt .Array [int8 ]]: ...
2692
2699
@overload
2693
2700
def __rdivmod__ (
2694
- self : _nt .Array [_RealNumberT ], x : _nt .Casts [_RealNumberT ] | _nt .ToBool_nd , /
2701
+ self : _nt .Array [_RealNumberT , _nt . Shape ], x : _nt .Casts [_RealNumberT , _nt . Shape ] | _nt .ToBool_nd , /
2695
2702
) -> _2Tuple [_nt .Array [_RealNumberT ]]: ...
2696
2703
@overload
2697
2704
def __rdivmod__ (
2698
- self : _nt .Array [_CoFloatingT ], x : _nt .CastsWith [_CoFloatingT , _RealScalarT ], /
2705
+ self : _nt .Array [_CoFloatingT , _nt . Shape ], x : _nt .CastsWith [_CoFloatingT , _RealScalarT , _nt . Shape ], /
2699
2706
) -> _2Tuple [_nt .Array [_RealScalarT ]]: ...
2700
2707
@overload
2701
- def __rdivmod__ (self : _nt .CastsWithInt [_RealScalarT ], x : _PyIntND , / ) -> _2Tuple [_nt .Array [_RealScalarT ]]: ...
2708
+ def __rdivmod__ (
2709
+ self : _nt .CastsWithInt [_RealScalarT , _nt .Shape ], x : _PyIntND , /
2710
+ ) -> _2Tuple [_nt .Array [_RealScalarT ]]: ...
2702
2711
@overload
2703
- def __rdivmod__ (self : _nt .CastsWithFloat [_RealScalarT ], x : _PyFloatND , / ) -> _2Tuple [_nt .Array [_RealScalarT ]]: ...
2712
+ def __rdivmod__ (
2713
+ self : _nt .CastsWithFloat [_RealScalarT , _nt .Shape ], x : _PyFloatND , /
2714
+ ) -> _2Tuple [_nt .Array [_RealScalarT ]]: ...
2704
2715
@overload
2705
2716
def __rdivmod__ (
2706
- self : _nt .Array [timedelta64 ], x : _nt .ToTimeDelta_nd , /
2717
+ self : _nt .Array [timedelta64 , _nt . Shape ], x : _nt .ToTimeDelta_nd , /
2707
2718
) -> tuple [_nt .Array [int64 ], _nt .Array [timedelta64 ]]: ...
2708
2719
@overload
2709
- def __rdivmod__ (self : _nt .Array [object_ ], x : object , / ) -> _2Tuple [_nt .Array [object_ ]]: ...
2720
+ def __rdivmod__ (self : _nt .Array [object_ , _nt . Shape ], x : object , / ) -> _2Tuple [_nt .Array [object_ ]]: ...
2710
2721
2711
2722
#
2712
2723
@overload
0 commit comments