@@ -20,6 +20,7 @@ from datetime import (
2020 timedelta ,
2121)
2222from pathlib import Path
23+ import sys
2324from typing import (
2425 Any ,
2526 ClassVar ,
@@ -78,6 +79,7 @@ from pandas.core.base import (
7879 ScalarArraySeriesJustFloat ,
7980 ScalarArraySeriesJustInt ,
8081 SeriesComplex ,
82+ SeriesReal ,
8183 Supports_ProtoAdd ,
8284 Supports_ProtoFloorDiv ,
8385 Supports_ProtoMul ,
@@ -220,6 +222,7 @@ from pandas._typing import (
220222 np_ndarray_complex ,
221223 np_ndarray_dt ,
222224 np_ndarray_float ,
225+ np_ndarray_num ,
223226 np_ndarray_str ,
224227 np_ndarray_td ,
225228 npt ,
@@ -2160,22 +2163,22 @@ class Series(IndexOpsMixin[S1], ElementOpsMixin[S1], NDFrame):
21602163 def __and__ (self , other : int | np_ndarray_anyint | Series [int ]) -> Series [int ]: ...
21612164 def __eq__ (self , other : object ) -> Series [_bool ]: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride]
21622165 @overload
2166+ def __floordiv__ (self , other : np_ndarray_dt ) -> Never : ...
2167+ @overload
21632168 def __floordiv__ (
21642169 self : Series [Never ], other : np_ndarray_td | TimedeltaIndex
21652170 ) -> Never : ...
21662171 @overload
21672172 def __floordiv__ (
2168- self : Series [int ] | Series [float ],
2169- other : np_ndarray_complex | np_ndarray_dt | np_ndarray_td ,
2173+ self : Series [int ] | Series [float ], other : np_ndarray_complex | np_ndarray_td
21702174 ) -> Never : ...
21712175 @overload
21722176 def __floordiv__ (
21732177 self : Series [Never ], other : ScalarArrayIndexSeriesReal
21742178 ) -> Series : ...
21752179 @overload
21762180 def __floordiv__ (
2177- self : Series [bool ] | Series [int ] | Series [float ] | Series [Timedelta ],
2178- other : Index [Never ] | Series [Never ],
2181+ self : SeriesReal | Series [Timedelta ], other : Index [Never ] | Series [Never ]
21792182 ) -> Series : ...
21802183 @overload
21812184 def __floordiv__ (
@@ -2210,25 +2213,21 @@ class Series(IndexOpsMixin[S1], ElementOpsMixin[S1], NDFrame):
22102213 float | Sequence [float ] | np_ndarray_float | Index [float ] | Series [float ]
22112214 ),
22122215 ) -> Series [float ]: ...
2216+ if sys .version_info >= (3 , 11 ):
2217+ @overload
2218+ def __floordiv__ (
2219+ self : Series [Timedelta ], other : np_ndarray_bool | np_ndarray_complex
2220+ ) -> Never : ...
2221+ else :
2222+ @overload
2223+ def __floordiv__ ( # type: ignore[overload-overlap]
2224+ self : Series [Timedelta ], other : np_ndarray_bool | np_ndarray_complex
2225+ ) -> Never : ...
2226+
22132227 @overload
22142228 def __floordiv__ (
22152229 self : Series [Timedelta ],
2216- other : np_ndarray_bool | np_ndarray_complex | np_ndarray_dt ,
2217- ) -> Never : ...
2218- @overload
2219- def __floordiv__ (
2220- self : Series [Timedelta ],
2221- other : (
2222- Just [int ]
2223- | Just [float ]
2224- | Sequence [Just [int ] | Just [float ]]
2225- | np_ndarray_anyint
2226- | np_ndarray_float
2227- | Index [int ]
2228- | Index [float ]
2229- | Series [int ]
2230- | Series [float ]
2231- ),
2230+ other : ScalarArraySeriesJustInt | ScalarArraySeriesJustFloat ,
22322231 ) -> Series [Timedelta ]: ...
22332232 @overload
22342233 def __floordiv__ (
@@ -2252,7 +2251,7 @@ class Series(IndexOpsMixin[S1], ElementOpsMixin[S1], NDFrame):
22522251 ) -> Series : ...
22532252 @overload
22542253 def floordiv (
2255- self : Series [ bool ] | Series [ int ] | Series [ float ] | Series [Timedelta ],
2254+ self : SeriesReal | Series [Timedelta ],
22562255 other : Index [Never ] | Series [Never ],
22572256 level : Level | None = ...,
22582257 fill_value : float | None = None ,
@@ -2311,17 +2310,7 @@ class Series(IndexOpsMixin[S1], ElementOpsMixin[S1], NDFrame):
23112310 @overload
23122311 def floordiv (
23132312 self : Series [Timedelta ],
2314- other : (
2315- Just [int ]
2316- | Just [float ]
2317- | Sequence [Just [int ] | Just [float ]]
2318- | np_ndarray_anyint
2319- | np_ndarray_float
2320- | Index [int ]
2321- | Index [float ]
2322- | Series [int ]
2323- | Series [float ]
2324- ),
2313+ other : ScalarArraySeriesJustInt | ScalarArraySeriesJustFloat ,
23252314 level : Level | None = ...,
23262315 fill_value : float | None = None ,
23272316 axis : AxisIndex | None = 0 ,
@@ -2350,8 +2339,7 @@ class Series(IndexOpsMixin[S1], ElementOpsMixin[S1], NDFrame):
23502339 ) -> Never : ...
23512340 @overload
23522341 def __rfloordiv__ (
2353- self : Series [bool ] | Series [int ] | Series [float ] | Series [Timedelta ],
2354- other : Index [Never ] | Series [Never ],
2342+ self : SeriesReal | Series [Timedelta ], other : Index [Never ] | Series [Never ]
23552343 ) -> Series : ...
23562344 @overload
23572345 def __rfloordiv__ (
@@ -2382,17 +2370,15 @@ class Series(IndexOpsMixin[S1], ElementOpsMixin[S1], NDFrame):
23822370 float | Sequence [float ] | np_ndarray_float | Index [float ] | Series [float ]
23832371 ),
23842372 ) -> Series [float ]: ...
2385- @overload
2386- def __rfloordiv__ (
2387- self : Series [Timedelta ],
2388- other : (
2389- np_ndarray_bool
2390- | np_ndarray_anyint
2391- | np_ndarray_float
2392- | np_ndarray_complex
2393- | np_ndarray_dt
2394- ),
2395- ) -> Never : ...
2373+ if sys .version_info >= (3 , 11 ):
2374+ @overload
2375+ def __rfloordiv__ (self : Series [Timedelta ], other : np_ndarray_num ) -> Never : ...
2376+ else :
2377+ @overload
2378+ def __rfloordiv__ ( # type: ignore[overload-overlap]
2379+ self : Series [Timedelta ], other : np_ndarray_num
2380+ ) -> Never : ...
2381+
23962382 @overload
23972383 def __rfloordiv__ (
23982384 self : Series [int ] | Series [float ],
@@ -2417,7 +2403,7 @@ class Series(IndexOpsMixin[S1], ElementOpsMixin[S1], NDFrame):
24172403 ) -> Series : ...
24182404 @overload
24192405 def rfloordiv (
2420- self : Series [ bool ] | Series [ int ] | Series [ float ] | Series [Timedelta ],
2406+ self : SeriesReal | Series [Timedelta ],
24212407 other : Index [Never ] | Series [Never ],
24222408 level : Level | None = ...,
24232409 fill_value : float | None = None ,
@@ -3815,8 +3801,7 @@ class Series(IndexOpsMixin[S1], ElementOpsMixin[S1], NDFrame):
38153801 ) -> Series : ...
38163802 @overload
38173803 def __rtruediv__ (
3818- self : Series [bool ] | Series [int ] | Series [float ] | Series [complex ],
3819- other : Index [Never ] | Series [Never ],
3804+ self : SeriesComplex , other : Index [Never ] | Series [Never ]
38203805 ) -> Series : ...
38213806 @overload
38223807 def __rtruediv__ (
@@ -3891,7 +3876,7 @@ class Series(IndexOpsMixin[S1], ElementOpsMixin[S1], NDFrame):
38913876 ) -> Series : ...
38923877 @overload
38933878 def rtruediv (
3894- self : Series [ bool ] | Series [ int ] | Series [ float ] | Series [ complex ] ,
3879+ self : SeriesComplex ,
38953880 other : Index [Never ] | Series [Never ],
38963881 level : Level | None = None ,
38973882 fill_value : float | None = None ,
@@ -3985,7 +3970,7 @@ class Series(IndexOpsMixin[S1], ElementOpsMixin[S1], NDFrame):
39853970 ) -> Series [float ]: ...
39863971 @overload
39873972 def rtruediv (
3988- self : Series [ bool ] | Series [ int ] | Series [ float ] ,
3973+ self : SeriesReal ,
39893974 other : ScalarArrayIndexSeriesTimedelta ,
39903975 level : Level | None = None ,
39913976 fill_value : float | None = None ,
0 commit comments