@@ -302,6 +302,30 @@ _DataLike: TypeAlias = ArrayLike | dict[str, np.ndarray] | SequenceNotStr[S1]
302302_DataLikeS1 : TypeAlias = (
303303 ArrayLike | dict [_str , np .ndarray ] | Sequence [S1 ] | IndexOpsMixin [S1 ]
304304)
305+ _OtherFloorDivNumPyGeneric : TypeAlias = np .bool | np .integer | np .floating
306+ _OtherFloorDiv : TypeAlias = (
307+ float
308+ | _OtherFloorDivNumPyGeneric
309+ | Sequence [float | _OtherFloorDivNumPyGeneric ]
310+ | np_ndarray [tuple [int , ...], _OtherFloorDivNumPyGeneric ]
311+ | Index [bool ]
312+ | Index [int ]
313+ | Index [float ]
314+ | Series [bool ]
315+ | Series [int ]
316+ | Series [float ]
317+ )
318+ _OtherTrueDivNumPyGeneric : TypeAlias = _OtherFloorDivNumPyGeneric | np .complex128
319+ _OtherTrueDiv : TypeAlias = (
320+ _OtherFloorDiv
321+ | complex
322+ | _OtherTrueDivNumPyGeneric
323+ | Sequence [complex | _OtherTrueDivNumPyGeneric ]
324+ | np_ndarray_complex
325+ | Index [complex ]
326+ | Series [complex ]
327+ )
328+ _OtherRTrueDiv : TypeAlias = _OtherTrueDiv
305329
306330class Series (IndexOpsMixin [S1 ], ElementOpsMixin [S1 ], NDFrame ):
307331 # Define __index__ because mypy thinks Series follows protocol `SupportsIndex` https://github.com/pandas-dev/pandas-stubs/pull/1332#discussion_r2285648790
@@ -2150,33 +2174,22 @@ class Series(IndexOpsMixin[S1], ElementOpsMixin[S1], NDFrame):
21502174 def __and__ (self , other : int | np_ndarray_anyint | Series [int ]) -> Series [int ]: ...
21512175 def __eq__ (self , other : object ) -> Series [_bool ]: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride]
21522176 @overload
2153- def __floordiv__ ( # type: ignore[overload-overlap]
2154- self : Series [Never ],
2155- other : (
2156- float
2157- | Sequence [float ]
2158- | np_ndarray_bool
2159- | np_ndarray_anyint
2160- | np_ndarray_float
2161- | Index [bool ]
2162- | Index [int ]
2163- | Index [float ]
2164- | Series [bool ]
2165- | Series [int ]
2166- | Series [float ]
2167- ),
2168- ) -> Series : ...
2169- @overload
21702177 def __floordiv__ (
2171- self : Series [bool ] | Series [int ] | Series [float ] | Series [Timedelta ],
2172- other : Index [Never ] | Series [Never ],
2173- ) -> Series : ...
2178+ self : Series [Never ], other : np_ndarray_td | TimedeltaIndex
2179+ ) -> Never : ...
21742180 @overload
21752181 def __floordiv__ (
21762182 self : Series [int ] | Series [float ],
21772183 other : np_ndarray_complex | np_ndarray_dt | np_ndarray_td ,
21782184 ) -> Never : ...
21792185 @overload
2186+ def __floordiv__ (self : Series [Never ], other : _OtherFloorDiv ) -> Series : ...
2187+ @overload
2188+ def __floordiv__ (
2189+ self : Series [bool ] | Series [int ] | Series [float ] | Series [Timedelta ],
2190+ other : Index [Never ] | Series [Never ],
2191+ ) -> Series : ...
2192+ @overload
21802193 def __floordiv__ (
21812194 self : Series [bool ] | Series [complex ], other : np_ndarray
21822195 ) -> Never : ...
@@ -2237,19 +2250,15 @@ class Series(IndexOpsMixin[S1], ElementOpsMixin[S1], NDFrame):
22372250 @overload
22382251 def floordiv (
22392252 self : Series [Never ],
2240- other : (
2241- float
2242- | Sequence [float ]
2243- | np_ndarray_bool
2244- | np_ndarray_anyint
2245- | np_ndarray_float
2246- | Index [bool ]
2247- | Index [int ]
2248- | Index [float ]
2249- | Series [bool ]
2250- | Series [int ]
2251- | Series [float ]
2252- ),
2253+ other : np_ndarray_td | TimedeltaIndex ,
2254+ level : Level | None = None ,
2255+ fill_value : float | None = None ,
2256+ axis : AxisIndex = 0 ,
2257+ ) -> Never : ...
2258+ @overload
2259+ def floordiv (
2260+ self : Series [Never ],
2261+ other : _OtherFloorDiv ,
22532262 level : Level | None = ...,
22542263 fill_value : float | None = None ,
22552264 axis : AxisIndex | None = 0 ,
@@ -2356,20 +2365,21 @@ class Series(IndexOpsMixin[S1], ElementOpsMixin[S1], NDFrame):
23562365 ),
23572366 ) -> Series : ...
23582367 @overload
2359- def __rfloordiv__ (
2360- self : Series [bool ] | Series [int ] | Series [float ] | Series [Timedelta ],
2361- other : Index [Never ] | Series [Never ],
2362- ) -> Series : ...
2368+ def __rfloordiv__ (self , other : np_ndarray_complex | np_ndarray_dt ) -> Never : ...
23632369 @overload
23642370 def __rfloordiv__ (
2365- self : Series [int ] | Series [float ],
2366- other : np_ndarray_complex | np_ndarray_dt | np_ndarray_td ,
2371+ self : Series [int ] | Series [float ], other : np_ndarray_td
23672372 ) -> Never : ...
23682373 @overload
23692374 def __rfloordiv__ (
23702375 self : Series [bool ] | Series [complex ], other : np_ndarray
23712376 ) -> Never : ...
23722377 @overload
2378+ def __rfloordiv__ (
2379+ self : Series [bool ] | Series [int ] | Series [float ] | Series [Timedelta ],
2380+ other : Index [Never ] | Series [Never ],
2381+ ) -> Series : ...
2382+ @overload
23732383 def __rfloordiv__ (
23742384 self : Supports_ProtoRFloorDiv [_T_contra , S2 ],
23752385 other : _T_contra | Sequence [_T_contra ],
@@ -3628,17 +3638,23 @@ class Series(IndexOpsMixin[S1], ElementOpsMixin[S1], NDFrame):
36283638 axis : int = 0 ,
36293639 ) -> Series [BaseOffset ]: ...
36303640 @overload
3641+ def __truediv__ (self , other : np_ndarray_dt ) -> Never : ...
3642+ @overload
36313643 def __truediv__ ( # type: ignore[overload-overlap]
3632- self : Series [Never ], other : complex | NumListLike | Index | Series
3644+ self : Series [Never ], other : _OtherTrueDiv
36333645 ) -> Series : ...
36343646 @overload
3635- def __truediv__ (self , other : Index [Never ] | Series [Never ]) -> Series : ...
3647+ def __truediv__ (
3648+ self : Series [Never ], other : np_ndarray_td | TimedeltaIndex
3649+ ) -> Never : ...
36363650 @overload
3637- def __truediv__ (self : Series [bool ], other : np_ndarray_bool ) -> Never : ...
3651+ def __truediv__ (self : Series [T_COMPLEX ], other : np_ndarray_td ) -> Never : ...
36383652 @overload
3639- def __truediv__ (self , other : np_ndarray_dt ) -> Never : ...
3653+ def __truediv__ (self : Series [ bool ] , other : np_ndarray_bool ) -> Never : ...
36403654 @overload
3641- def __truediv__ (self : Series [T_COMPLEX ], other : np_ndarray_td ) -> Never : ...
3655+ def __truediv__ (
3656+ self : Series [T_COMPLEX ], other : Index [Never ] | Series [Never ]
3657+ ) -> Series : ...
36423658 @overload
36433659 def __truediv__ (
36443660 self : Series [Timedelta ],
@@ -3738,18 +3754,26 @@ class Series(IndexOpsMixin[S1], ElementOpsMixin[S1], NDFrame):
37383754 other : np_ndarray_td | TimedeltaIndex | Series [Timedelta ],
37393755 ) -> Series [float ]: ...
37403756 @overload
3741- def __truediv__ (self , other : Path ) -> Series : ...
3757+ def __truediv__ (self : Series [ _str ] , other : Path ) -> Series : ...
37423758 @overload
37433759 def truediv (
37443760 self : Series [Never ],
3745- other : complex | ListLike ,
3761+ other : _OtherTrueDiv ,
37463762 level : Level | None = None ,
37473763 fill_value : float | None = None ,
37483764 axis : AxisIndex = 0 ,
37493765 ) -> Series : ...
37503766 @overload
37513767 def truediv (
3752- self ,
3768+ self : Series [Never ],
3769+ other : np_ndarray_td | TimedeltaIndex ,
3770+ level : Level | None = None ,
3771+ fill_value : float | None = None ,
3772+ axis : AxisIndex = 0 ,
3773+ ) -> Never : ...
3774+ @overload
3775+ def truediv (
3776+ self : Series [bool ] | Series [int ] | Series [float ] | Series [complex ],
37533777 other : Index [Never ] | Series [Never ],
37543778 level : Level | None = None ,
37553779 fill_value : float | None = None ,
@@ -3880,29 +3904,28 @@ class Series(IndexOpsMixin[S1], ElementOpsMixin[S1], NDFrame):
38803904 ) -> Series [float ]: ...
38813905 @overload
38823906 def truediv (
3883- self ,
3907+ self : Series [ _str ] ,
38843908 other : Path ,
38853909 level : Level | None = None ,
38863910 fill_value : float | None = None ,
38873911 axis : AxisIndex = 0 ,
38883912 ) -> Series : ...
38893913 div = truediv
38903914 @overload
3891- def __rtruediv__ ( # type: ignore[overload-overlap]
3892- self : Series [Never ], other : complex | NumListLike | Index | Series
3893- ) -> Series : ...
3894- @overload
3895- def __rtruediv__ (self , other : Index [Never ] | Series [Never ]) -> Series : ...
3896- @overload
3897- def __rtruediv__ (self : Series [bool ], other : np_ndarray_bool ) -> Never : ...
3898- @overload
38993915 def __rtruediv__ (self , other : np_ndarray_dt ) -> Never : ...
39003916 @overload
39013917 def __rtruediv__ (
3902- self : Series [Timedelta ],
3903- other : np_ndarray_bool | np_ndarray_complex ,
3918+ self : Series [Never ],
3919+ other : timedelta | Sequence [ timedelta ] | np_ndarray_td | TimedeltaIndex ,
39043920 ) -> Never : ...
39053921 @overload
3922+ def __rtruediv__ (self : Series [Never ], other : _OtherRTrueDiv ) -> Series : ...
3923+ @overload
3924+ def __rtruediv__ (
3925+ self : Series [bool ] | Series [int ] | Series [float ] | Series [complex ],
3926+ other : Index [Never ] | Series [Never ],
3927+ ) -> Series : ...
3928+ @overload
39063929 def __rtruediv__ (
39073930 self : Supports_ProtoRTrueDiv [_T_contra , S2 ],
39083931 other : _T_contra | Sequence [_T_contra ],
@@ -3990,18 +4013,26 @@ class Series(IndexOpsMixin[S1], ElementOpsMixin[S1], NDFrame):
39904013 ),
39914014 ) -> Series [Timedelta ]: ...
39924015 @overload
3993- def __rtruediv__ (self , other : Path ) -> Series : ...
4016+ def __rtruediv__ (self : Series [ _str ] , other : Path ) -> Series : ...
39944017 @overload
39954018 def rtruediv (
39964019 self : Series [Never ],
3997- other : complex | ListLike ,
4020+ other : _OtherRTrueDiv ,
39984021 level : Level | None = None ,
39994022 fill_value : float | None = None ,
40004023 axis : AxisIndex = 0 ,
40014024 ) -> Series : ...
40024025 @overload
40034026 def rtruediv (
4004- self ,
4027+ self : Series [Never ],
4028+ other : timedelta | Sequence [timedelta ] | np_ndarray_td | TimedeltaIndex ,
4029+ level : Level | None = None ,
4030+ fill_value : float | None = None ,
4031+ axis : AxisIndex = 0 ,
4032+ ) -> Never : ...
4033+ @overload
4034+ def rtruediv (
4035+ self : Series [bool ] | Series [int ] | Series [float ] | Series [complex ],
40054036 other : Index [Never ] | Series [Never ],
40064037 level : Level | None = None ,
40074038 fill_value : float | None = None ,
@@ -4127,7 +4158,7 @@ class Series(IndexOpsMixin[S1], ElementOpsMixin[S1], NDFrame):
41274158 ) -> Series [Timedelta ]: ...
41284159 @overload
41294160 def rtruediv (
4130- self ,
4161+ self : Series [ _str ] ,
41314162 other : Path ,
41324163 level : Level | None = None ,
41334164 fill_value : float | None = None ,
0 commit comments