@@ -29,37 +29,38 @@ from _typeshed import (
2929 _T_contra ,
3030)
3131import numpy as np
32- from pandas import (
33- DataFrame ,
34- DatetimeIndex ,
35- Interval ,
36- IntervalIndex ,
37- MultiIndex ,
38- Period ,
39- PeriodDtype ,
40- PeriodIndex ,
41- Series ,
42- TimedeltaIndex ,
43- )
4432from pandas .core .arrays .boolean import BooleanArray
4533from pandas .core .base import (
4634 ElementOpsMixin ,
4735 IndexOpsMixin ,
4836 Supports_ProtoAdd ,
37+ Supports_ProtoFloorDiv ,
4938 Supports_ProtoMul ,
5039 Supports_ProtoRAdd ,
40+ Supports_ProtoRFloorDiv ,
5141 Supports_ProtoRMul ,
5242 Supports_ProtoRTrueDiv ,
5343 Supports_ProtoTrueDiv ,
5444)
45+ from pandas .core .frame import DataFrame
5546from pandas .core .indexes .category import CategoricalIndex
47+ from pandas .core .indexes .datetimes import DatetimeIndex
48+ from pandas .core .indexes .interval import IntervalIndex
49+ from pandas .core .indexes .multi import MultiIndex
50+ from pandas .core .indexes .period import PeriodIndex
51+ from pandas .core .indexes .timedeltas import TimedeltaIndex
52+ from pandas .core .series import Series
5653from pandas .core .strings .accessor import StringMethods
5754from typing_extensions import (
5855 Never ,
5956 Self ,
6057)
6158
62- from pandas ._libs .interval import _OrderableT
59+ from pandas ._libs .interval import (
60+ Interval ,
61+ _OrderableT ,
62+ )
63+ from pandas ._libs .tslibs .period import Period
6364from pandas ._libs .tslibs .timedeltas import Timedelta
6465from pandas ._typing import (
6566 C2 ,
@@ -97,6 +98,7 @@ from pandas._typing import (
9798 TimedeltaDtypeArg ,
9899 TimestampDtypeArg ,
99100 np_1darray ,
101+ np_ndarray ,
100102 np_ndarray_anyint ,
101103 np_ndarray_bool ,
102104 np_ndarray_complex ,
@@ -107,6 +109,8 @@ from pandas._typing import (
107109 type_t ,
108110)
109111
112+ from pandas .core .dtypes .dtypes import PeriodDtype
113+
110114class InvalidIndexError (Exception ): ...
111115
112116class Index (IndexOpsMixin [S1 ], ElementOpsMixin [S1 ]):
@@ -942,14 +946,17 @@ class Index(IndexOpsMixin[S1], ElementOpsMixin[S1]):
942946 @overload
943947 def __truediv__ (self : Index [bool ], other : np_ndarray_bool ) -> Never : ...
944948 @overload
949+ def __truediv__ (self , other : np_ndarray_dt ) -> Never : ...
950+ @overload
951+ def __truediv__ (self : Index [T_COMPLEX ], other : np_ndarray_td ) -> Never : ...
952+ @overload
945953 def __truediv__ (
946954 self : Supports_ProtoTrueDiv [_T_contra , S2 ],
947955 other : _T_contra | Sequence [_T_contra ],
948956 ) -> Index [S2 ]: ...
949957 @overload
950958 def __truediv__ (
951- self : Index [int ],
952- other : np_ndarray_bool | Index [bool ],
959+ self : Index [int ], other : np_ndarray_bool | Index [bool ]
953960 ) -> Index [float ]: ...
954961 @overload
955962 def __truediv__ (
@@ -993,10 +1000,12 @@ class Index(IndexOpsMixin[S1], ElementOpsMixin[S1]):
9931000 self : Index [Never ], other : complex | ArrayLike | SequenceNotStr [S1 ] | Index
9941001 ) -> Index : ...
9951002 @overload
996- def __rtruediv__ (self , other : Index [Never ]) -> Index : ...
1003+ def __rtruediv__ (self , other : Index [Never ]) -> Index : ... # type: ignore[overload-overlap]
9971004 @overload
9981005 def __rtruediv__ (self : Index [bool ], other : np_ndarray_bool ) -> Never : ...
9991006 @overload
1007+ def __rtruediv__ (self , other : np_ndarray_dt ) -> Never : ...
1008+ @overload
10001009 def __rtruediv__ (
10011010 self : Supports_ProtoRTrueDiv [_T_contra , S2 ],
10021011 other : _T_contra | Sequence [_T_contra ],
@@ -1041,13 +1050,91 @@ class Index(IndexOpsMixin[S1], ElementOpsMixin[S1]):
10411050 ),
10421051 ) -> Index [complex ]: ...
10431052 @overload
1053+ def __rtruediv__ (
1054+ self : Index [int ] | Index [float ],
1055+ other : timedelta | np .timedelta64 | np_ndarray_td | TimedeltaIndex ,
1056+ ) -> TimedeltaIndex : ...
1057+ @overload
10441058 def __rtruediv__ (self , other : Path ) -> Index : ...
1059+ @overload
1060+ def __floordiv__ (self , other : Index [Never ]) -> Index : ...
1061+ @overload
10451062 def __floordiv__ (
1046- self , other : float | Sequence [float ] | Index [int ] | Index [float ]
1047- ) -> Self : ...
1063+ self : Index [int ] | Index [float ],
1064+ other : np_ndarray_complex | np_ndarray_dt | np_ndarray_td ,
1065+ ) -> Never : ...
1066+ @overload
1067+ def __floordiv__ (
1068+ self : Index [bool ] | Index [complex ], other : np_ndarray
1069+ ) -> Never : ...
1070+ @overload
1071+ def __floordiv__ (
1072+ self : Supports_ProtoFloorDiv [_T_contra , S2 ],
1073+ other : _T_contra | Sequence [_T_contra ],
1074+ ) -> Index [S2 ]: ...
1075+ @overload
1076+ def __floordiv__ (
1077+ self : Index [int ], other : np_ndarray_bool | Index [bool ]
1078+ ) -> Index [int ]: ...
1079+ @overload
1080+ def __floordiv__ (
1081+ self : Index [float ], other : np_ndarray_bool | Index [bool ]
1082+ ) -> Index [float ]: ...
1083+ @overload
1084+ def __floordiv__ (
1085+ self : Index [bool ] | Index [int ], other : np_ndarray_anyint | Index [int ]
1086+ ) -> Index [int ]: ...
1087+ @overload
1088+ def __floordiv__ (
1089+ self : Index [float ], other : np_ndarray_anyint | Index [int ]
1090+ ) -> Index [float ]: ...
1091+ @overload
1092+ def __floordiv__ (
1093+ self : Index [int ] | Index [float ],
1094+ other : float | Sequence [float ] | np_ndarray_float | Index [float ],
1095+ ) -> Index [float ]: ...
1096+ @overload
1097+ def __rfloordiv__ (self , other : Index [Never ]) -> Index : ... # type: ignore[overload-overlap]
1098+ @overload
10481099 def __rfloordiv__ (
1049- self , other : float | Sequence [float ] | Index [int ] | Index [float ]
1050- ) -> Self : ...
1100+ self : Index [int ] | Index [float ],
1101+ other : np_ndarray_complex | np_ndarray_dt | np_ndarray_td ,
1102+ ) -> Never : ...
1103+ @overload
1104+ def __rfloordiv__ (
1105+ self : Index [bool ] | Index [complex ], other : np_ndarray
1106+ ) -> Never : ...
1107+ @overload
1108+ def __rfloordiv__ (
1109+ self : Supports_ProtoRFloorDiv [_T_contra , S2 ],
1110+ other : _T_contra | Sequence [_T_contra ],
1111+ ) -> Index [S2 ]: ...
1112+ @overload
1113+ def __rfloordiv__ (
1114+ self : Index [int ], other : np_ndarray_bool | Index [bool ]
1115+ ) -> Index [int ]: ...
1116+ @overload
1117+ def __rfloordiv__ (
1118+ self : Index [float ], other : np_ndarray_bool | Index [bool ]
1119+ ) -> Index [float ]: ...
1120+ @overload
1121+ def __rfloordiv__ (
1122+ self : Index [bool ] | Index [int ], other : np_ndarray_anyint | Index [int ]
1123+ ) -> Index [int ]: ...
1124+ @overload
1125+ def __rfloordiv__ (
1126+ self : Index [float ], other : np_ndarray_anyint | Index [int ]
1127+ ) -> Index [float ]: ...
1128+ @overload
1129+ def __rfloordiv__ (
1130+ self : Index [int ] | Index [float ],
1131+ other : float | Sequence [float ] | np_ndarray_float | Index [float ],
1132+ ) -> Index [float ]: ...
1133+ @overload
1134+ def __rfloordiv__ (
1135+ self : Index [int ] | Index [float ],
1136+ other : timedelta | np_ndarray_td | TimedeltaIndex ,
1137+ ) -> TimedeltaIndex : ...
10511138 def infer_objects (self , copy : bool = True ) -> Self : ...
10521139
10531140@type_check_only
0 commit comments