@@ -353,7 +353,6 @@ from ._typing import (
353353 DTypeLike ,
354354 NBitBase ,
355355 NDArray ,
356- _ArrayLike ,
357356 _ArrayLikeDT64_co ,
358357 _ArrayLikeObject_co ,
359358 _ArrayLikeTD64_co ,
@@ -2672,79 +2671,59 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DTypeT_co]):
26722671 @overload
26732672 def __imod__ (self : NDArray [object_ ], x : object , / ) -> ndarray [_ShapeT_co , _DTypeT_co ]: ...
26742673
2675- # TODO(jorenham): rewrite the binops below
2676-
26772674 #
26782675 @overload
2679- def __divmod__ ( # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
2680- self : NDArray [_RealNumberT ],
2681- rhs : int | bool_ ,
2682- / ,
2683- ) -> _2Tuple [_nt .Array [_RealNumberT , _ShapeT_co ]]: ...
2684- @overload
2685- def __divmod__ (self : NDArray [_RealNumberT ], rhs : _nt .ToBool_nd , / ) -> _2Tuple [NDArray [_RealNumberT ]]: ... # type: ignore[overload-overlap]
2686- @overload
2687- def __divmod__ (self : NDArray [bool_ ], rhs : _ArrayLike [_RealNumberT ], / ) -> _2Tuple [NDArray [_RealNumberT ]]: ...
2688- @overload
2689- def __divmod__ (self : NDArray [bool_ ], rhs : _nt .ToBool_nd , / ) -> _2Tuple [NDArray [int8 ]]: ...
2690- @overload
2691- def __divmod__ (self : NDArray [float64 ], rhs : _nt .CoFloat64_nd , / ) -> _2Tuple [NDArray [float64 ]]: ...
2692- @overload
2693- def __divmod__ (self : _ArrayFloat64_co , rhs : _nt .ToFloat64_nd , / ) -> _2Tuple [NDArray [float64 ]]: ...
2694- @overload
2695- def __divmod__ (self : NDArray [unsignedinteger ], rhs : _nt .CoUInt64_nd , / ) -> _2Tuple [NDArray [unsignedinteger ]]: ...
2676+ def __divmod__ (self : NDArray [bool_ ], x : _nt .ToBool_nd , / ) -> _2Tuple [NDArray [int8 ]]: ...
26962677 @overload
2697- def __divmod__ (self : _ArrayUInt_co , rhs : _nt .ToUInteger_nd , / ) -> _2Tuple [NDArray [unsignedinteger ]]: ...
2678+ def __divmod__ (self : NDArray [ _RealNumberT ], x : _nt .Casts [ _RealNumberT ] , / ) -> _2Tuple [NDArray [_RealNumberT ]]: ...
26982679 @overload
2699- def __divmod__ (self : NDArray [signedinteger ], rhs : _nt .CoInt64_nd , / ) -> _2Tuple [NDArray [signedinteger ]]: ...
2680+ def __divmod__ (
2681+ self : NDArray [_RealT ], x : _nt .CastsWith [_RealT , _RealScalarT ], /
2682+ ) -> _2Tuple [NDArray [_RealScalarT ]]: ...
27002683 @overload
2701- def __divmod__ (self : _ArrayInt_co , rhs : _nt .ToSInteger_nd , / ) -> _2Tuple [NDArray [signedinteger ]]: ...
2684+ def __divmod__ (self : NDArray [ _RealNumberT ], x : _nt .SequenceND [ py_bool ] , / ) -> _2Tuple [NDArray [_RealNumberT ]]: ...
27022685 @overload
2703- def __divmod__ (self : NDArray [floating ], rhs : _nt .CoFloating_nd , / ) -> _2Tuple [NDArray [floating ]]: ...
2686+ def __divmod__ (
2687+ self : _nt .CastsWithInt [_RealScalarT ], x : _nt .SequenceND [_nt .JustInt ], /
2688+ ) -> _2Tuple [NDArray [_RealScalarT ]]: ...
27042689 @overload
2705- def __divmod__ (self : NDArray [floating | integer ], rhs : _nt .ToFloating_nd , / ) -> _2Tuple [NDArray [floating ]]: ...
2690+ def __divmod__ (
2691+ self : _nt .CastsWithFloat [_RealScalarT ], x : _nt .SequenceND [_nt .JustFloat ], /
2692+ ) -> _2Tuple [NDArray [_RealScalarT ]]: ...
27062693 @overload
27072694 def __divmod__ (
2708- self : NDArray [timedelta64 ],
2709- rhs : _ArrayLike [timedelta64 ],
2710- / ,
2695+ self : NDArray [timedelta64 ], x : _nt .ToTimeDelta_nd , /
27112696 ) -> tuple [NDArray [int64 ], NDArray [timedelta64 ]]: ...
2712-
2713- # keep in sync with __divmod__
27142697 @overload
2715- def __rdivmod__ ( # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
2716- self : NDArray [_RealNumberT ],
2717- lhs : int | bool_ ,
2718- / ,
2719- ) -> _2Tuple [_nt .Array [_RealNumberT , _ShapeT_co ]]: ...
2720- @overload
2721- def __rdivmod__ (self : NDArray [_RealNumberT ], lhs : _nt .ToBool_nd , / ) -> _2Tuple [NDArray [_RealNumberT ]]: ... # type: ignore[overload-overlap]
2722- @overload
2723- def __rdivmod__ (self : NDArray [bool_ ], lhs : _ArrayLike [_RealNumberT ], / ) -> _2Tuple [NDArray [_RealNumberT ]]: ...
2724- @overload
2725- def __rdivmod__ (self : NDArray [bool_ ], lhs : _nt .ToBool_nd , / ) -> _2Tuple [NDArray [int8 ]]: ...
2726- @overload
2727- def __rdivmod__ (self : NDArray [float64 ], lhs : _nt .CoFloat64_nd , / ) -> _2Tuple [NDArray [float64 ]]: ...
2728- @overload
2729- def __rdivmod__ (self : _ArrayFloat64_co , lhs : _nt .ToFloat64_nd , / ) -> _2Tuple [NDArray [float64 ]]: ...
2698+ def __divmod__ (self : NDArray [object_ ], x : object , / ) -> _2Tuple [NDArray [object_ ]]: ...
2699+
2700+ #
27302701 @overload
2731- def __rdivmod__ (self : NDArray [unsignedinteger ], lhs : _nt .CoUInt64_nd , / ) -> _2Tuple [NDArray [unsignedinteger ]]: ...
2702+ def __rdivmod__ (self : NDArray [bool_ ], x : _nt .ToBool_nd , / ) -> _2Tuple [NDArray [int8 ]]: ...
27322703 @overload
2733- def __rdivmod__ (self : _ArrayUInt_co , lhs : _nt .ToUInteger_nd , / ) -> _2Tuple [NDArray [unsignedinteger ]]: ...
2704+ def __rdivmod__ (self : NDArray [ _RealNumberT ], x : _nt .Casts [ _RealNumberT ] , / ) -> _2Tuple [NDArray [_RealNumberT ]]: ...
27342705 @overload
2735- def __rdivmod__ (self : NDArray [signedinteger ], lhs : _nt .CoInt64_nd , / ) -> _2Tuple [NDArray [signedinteger ]]: ...
2706+ def __rdivmod__ (
2707+ self : NDArray [_RealT ], x : _nt .CastsWith [_RealT , _RealScalarT ], /
2708+ ) -> _2Tuple [NDArray [_RealScalarT ]]: ...
27362709 @overload
2737- def __rdivmod__ (self : _ArrayInt_co , lhs : _nt .ToSInteger_nd , / ) -> _2Tuple [NDArray [signedinteger ]]: ...
2710+ def __rdivmod__ (self : NDArray [ _RealNumberT ], x : _nt .SequenceND [ py_bool ] , / ) -> _2Tuple [NDArray [_RealNumberT ]]: ...
27382711 @overload
2739- def __rdivmod__ (self : NDArray [floating ], lhs : _nt .CoFloating_nd , / ) -> _2Tuple [NDArray [floating ]]: ...
2712+ def __rdivmod__ (
2713+ self : _nt .CastsWithInt [_RealScalarT ], x : _nt .SequenceND [_nt .JustInt ], /
2714+ ) -> _2Tuple [NDArray [_RealScalarT ]]: ...
27402715 @overload
2741- def __rdivmod__ (self : NDArray [floating | integer ], lhs : _nt .ToFloating_nd , / ) -> _2Tuple [NDArray [floating ]]: ...
2716+ def __rdivmod__ (
2717+ self : _nt .CastsWithFloat [_RealScalarT ], x : _nt .SequenceND [_nt .JustFloat ], /
2718+ ) -> _2Tuple [NDArray [_RealScalarT ]]: ...
27422719 @overload
27432720 def __rdivmod__ (
2744- self : NDArray [timedelta64 ],
2745- lhs : _ArrayLike [timedelta64 ],
2746- / ,
2721+ self : NDArray [timedelta64 ], x : _nt .ToTimeDelta_nd , /
27472722 ) -> tuple [NDArray [int64 ], NDArray [timedelta64 ]]: ...
2723+ @overload
2724+ def __rdivmod__ (self : NDArray [object_ ], x : object , / ) -> _2Tuple [NDArray [object_ ]]: ...
2725+
2726+ # TODO(jorenham): rewrite the binops below
27482727
27492728 #
27502729 @overload
0 commit comments