@@ -28,36 +28,37 @@ from _typeshed import (
2828 _T_contra ,
2929)
3030import numpy as np
31- from pandas import (
32- DataFrame ,
33- DatetimeIndex ,
34- Interval ,
35- IntervalIndex ,
36- MultiIndex ,
37- Period ,
38- PeriodDtype ,
39- PeriodIndex ,
40- Series ,
41- TimedeltaIndex ,
42- )
4331from pandas .core .base import (
4432 ElementOpsMixin ,
4533 IndexOpsMixin ,
4634 Supports_ProtoAdd ,
35+ Supports_ProtoFloorDiv ,
4736 Supports_ProtoMul ,
4837 Supports_ProtoRAdd ,
38+ Supports_ProtoRFloorDiv ,
4939 Supports_ProtoRMul ,
5040 Supports_ProtoRTrueDiv ,
5141 Supports_ProtoTrueDiv ,
5242)
43+ from pandas .core .frame import DataFrame
5344from pandas .core .indexes .category import CategoricalIndex
45+ from pandas .core .indexes .datetimes import DatetimeIndex
46+ from pandas .core .indexes .interval import IntervalIndex
47+ from pandas .core .indexes .multi import MultiIndex
48+ from pandas .core .indexes .period import PeriodIndex
49+ from pandas .core .indexes .timedeltas import TimedeltaIndex
50+ from pandas .core .series import Series
5451from pandas .core .strings .accessor import StringMethods
5552from typing_extensions import (
5653 Never ,
5754 Self ,
5855)
5956
60- from pandas ._libs .interval import _OrderableT
57+ from pandas ._libs .interval import (
58+ Interval ,
59+ _OrderableT ,
60+ )
61+ from pandas ._libs .tslibs .period import Period
6162from pandas ._libs .tslibs .timedeltas import Timedelta
6263from pandas ._typing import (
6364 C2 ,
@@ -94,6 +95,7 @@ from pandas._typing import (
9495 TimedeltaDtypeArg ,
9596 TimestampDtypeArg ,
9697 np_1darray ,
98+ np_ndarray ,
9799 np_ndarray_anyint ,
98100 np_ndarray_bool ,
99101 np_ndarray_complex ,
@@ -104,6 +106,8 @@ from pandas._typing import (
104106 type_t ,
105107)
106108
109+ from pandas .core .dtypes .dtypes import PeriodDtype
110+
107111class InvalidIndexError (Exception ): ...
108112
109113class Index (IndexOpsMixin [S1 ], ElementOpsMixin [S1 ]):
@@ -911,14 +915,17 @@ class Index(IndexOpsMixin[S1], ElementOpsMixin[S1]):
911915 @overload
912916 def __truediv__ (self : Index [bool ], other : np_ndarray_bool ) -> Never : ...
913917 @overload
918+ def __truediv__ (self , other : np_ndarray_dt ) -> Never : ...
919+ @overload
920+ def __truediv__ (self : Index [T_COMPLEX ], other : np_ndarray_td ) -> Never : ...
921+ @overload
914922 def __truediv__ (
915923 self : Supports_ProtoTrueDiv [_T_contra , S2 ],
916924 other : _T_contra | Sequence [_T_contra ],
917925 ) -> Index [S2 ]: ...
918926 @overload
919927 def __truediv__ (
920- self : Index [int ],
921- other : np_ndarray_bool | Index [bool ],
928+ self : Index [int ], other : np_ndarray_bool | Index [bool ]
922929 ) -> Index [float ]: ...
923930 @overload
924931 def __truediv__ (
@@ -962,10 +969,12 @@ class Index(IndexOpsMixin[S1], ElementOpsMixin[S1]):
962969 self : Index [Never ], other : complex | ArrayLike | SequenceNotStr [S1 ] | Index
963970 ) -> Index : ...
964971 @overload
965- def __rtruediv__ (self , other : Index [Never ]) -> Index : ...
972+ def __rtruediv__ (self , other : Index [Never ]) -> Index : ... # type: ignore[overload-overlap]
966973 @overload
967974 def __rtruediv__ (self : Index [bool ], other : np_ndarray_bool ) -> Never : ...
968975 @overload
976+ def __rtruediv__ (self , other : np_ndarray_dt ) -> Never : ...
977+ @overload
969978 def __rtruediv__ (
970979 self : Supports_ProtoRTrueDiv [_T_contra , S2 ],
971980 other : _T_contra | Sequence [_T_contra ],
@@ -1010,13 +1019,91 @@ class Index(IndexOpsMixin[S1], ElementOpsMixin[S1]):
10101019 ),
10111020 ) -> Index [complex ]: ...
10121021 @overload
1022+ def __rtruediv__ (
1023+ self : Index [int ] | Index [float ],
1024+ other : timedelta | np .timedelta64 | np_ndarray_td | TimedeltaIndex ,
1025+ ) -> TimedeltaIndex : ...
1026+ @overload
10131027 def __rtruediv__ (self , other : Path ) -> Index : ...
1028+ @overload
1029+ def __floordiv__ (self , other : Index [Never ]) -> Index : ...
1030+ @overload
10141031 def __floordiv__ (
1015- self , other : float | Sequence [float ] | Index [int ] | Index [float ]
1016- ) -> Self : ...
1032+ self : Index [int ] | Index [float ],
1033+ other : np_ndarray_complex | np_ndarray_dt | np_ndarray_td ,
1034+ ) -> Never : ...
1035+ @overload
1036+ def __floordiv__ (
1037+ self : Index [bool ] | Index [complex ], other : np_ndarray
1038+ ) -> Never : ...
1039+ @overload
1040+ def __floordiv__ (
1041+ self : Supports_ProtoFloorDiv [_T_contra , S2 ],
1042+ other : _T_contra | Sequence [_T_contra ],
1043+ ) -> Index [S2 ]: ...
1044+ @overload
1045+ def __floordiv__ (
1046+ self : Index [int ], other : np_ndarray_bool | Index [bool ]
1047+ ) -> Index [int ]: ...
1048+ @overload
1049+ def __floordiv__ (
1050+ self : Index [float ], other : np_ndarray_bool | Index [bool ]
1051+ ) -> Index [float ]: ...
1052+ @overload
1053+ def __floordiv__ (
1054+ self : Index [bool ] | Index [int ], other : np_ndarray_anyint | Index [int ]
1055+ ) -> Index [int ]: ...
1056+ @overload
1057+ def __floordiv__ (
1058+ self : Index [float ], other : np_ndarray_anyint | Index [int ]
1059+ ) -> Index [float ]: ...
1060+ @overload
1061+ def __floordiv__ (
1062+ self : Index [int ] | Index [float ],
1063+ other : float | Sequence [float ] | np_ndarray_float | Index [float ],
1064+ ) -> Index [float ]: ...
1065+ @overload
1066+ def __rfloordiv__ (self , other : Index [Never ]) -> Index : ... # type: ignore[overload-overlap]
1067+ @overload
10171068 def __rfloordiv__ (
1018- self , other : float | Sequence [float ] | Index [int ] | Index [float ]
1019- ) -> Self : ...
1069+ self : Index [int ] | Index [float ],
1070+ other : np_ndarray_complex | np_ndarray_dt | np_ndarray_td ,
1071+ ) -> Never : ...
1072+ @overload
1073+ def __rfloordiv__ (
1074+ self : Index [bool ] | Index [complex ], other : np_ndarray
1075+ ) -> Never : ...
1076+ @overload
1077+ def __rfloordiv__ (
1078+ self : Supports_ProtoRFloorDiv [_T_contra , S2 ],
1079+ other : _T_contra | Sequence [_T_contra ],
1080+ ) -> Index [S2 ]: ...
1081+ @overload
1082+ def __rfloordiv__ (
1083+ self : Index [int ], other : np_ndarray_bool | Index [bool ]
1084+ ) -> Index [int ]: ...
1085+ @overload
1086+ def __rfloordiv__ (
1087+ self : Index [float ], other : np_ndarray_bool | Index [bool ]
1088+ ) -> Index [float ]: ...
1089+ @overload
1090+ def __rfloordiv__ (
1091+ self : Index [bool ] | Index [int ], other : np_ndarray_anyint | Index [int ]
1092+ ) -> Index [int ]: ...
1093+ @overload
1094+ def __rfloordiv__ (
1095+ self : Index [float ], other : np_ndarray_anyint | Index [int ]
1096+ ) -> Index [float ]: ...
1097+ @overload
1098+ def __rfloordiv__ (
1099+ self : Index [int ] | Index [float ],
1100+ other : float | Sequence [float ] | np_ndarray_float | Index [float ],
1101+ ) -> Index [float ]: ...
1102+ @overload
1103+ def __rfloordiv__ (
1104+ self : Index [int ] | Index [float ],
1105+ other : timedelta | np_ndarray_td | TimedeltaIndex ,
1106+ ) -> TimedeltaIndex : ...
10201107 def infer_objects (self , copy : bool = True ) -> Self : ...
10211108
10221109@type_check_only
0 commit comments