@@ -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 ,
@@ -96,6 +97,7 @@ from pandas._typing import (
9697 TimedeltaDtypeArg ,
9798 TimestampDtypeArg ,
9899 np_1darray ,
100+ np_ndarray ,
99101 np_ndarray_anyint ,
100102 np_ndarray_bool ,
101103 np_ndarray_complex ,
@@ -106,6 +108,8 @@ from pandas._typing import (
106108 type_t ,
107109)
108110
111+ from pandas .core .dtypes .dtypes import PeriodDtype
112+
109113class InvalidIndexError (Exception ): ...
110114
111115class Index (IndexOpsMixin [S1 ], ElementOpsMixin [S1 ]):
@@ -936,14 +940,17 @@ class Index(IndexOpsMixin[S1], ElementOpsMixin[S1]):
936940 @overload
937941 def __truediv__ (self : Index [bool ], other : np_ndarray_bool ) -> Never : ...
938942 @overload
943+ def __truediv__ (self , other : np_ndarray_dt ) -> Never : ...
944+ @overload
945+ def __truediv__ (self : Index [T_COMPLEX ], other : np_ndarray_td ) -> Never : ...
946+ @overload
939947 def __truediv__ (
940948 self : Supports_ProtoTrueDiv [_T_contra , S2 ],
941949 other : _T_contra | Sequence [_T_contra ],
942950 ) -> Index [S2 ]: ...
943951 @overload
944952 def __truediv__ (
945- self : Index [int ],
946- other : np_ndarray_bool | Index [bool ],
953+ self : Index [int ], other : np_ndarray_bool | Index [bool ]
947954 ) -> Index [float ]: ...
948955 @overload
949956 def __truediv__ (
@@ -987,10 +994,12 @@ class Index(IndexOpsMixin[S1], ElementOpsMixin[S1]):
987994 self : Index [Never ], other : complex | ArrayLike | SequenceNotStr [S1 ] | Index
988995 ) -> Index : ...
989996 @overload
990- def __rtruediv__ (self , other : Index [Never ]) -> Index : ...
997+ def __rtruediv__ (self , other : Index [Never ]) -> Index : ... # type: ignore[overload-overlap]
991998 @overload
992999 def __rtruediv__ (self : Index [bool ], other : np_ndarray_bool ) -> Never : ...
9931000 @overload
1001+ def __rtruediv__ (self , other : np_ndarray_dt ) -> Never : ...
1002+ @overload
9941003 def __rtruediv__ (
9951004 self : Supports_ProtoRTrueDiv [_T_contra , S2 ],
9961005 other : _T_contra | Sequence [_T_contra ],
@@ -1035,13 +1044,91 @@ class Index(IndexOpsMixin[S1], ElementOpsMixin[S1]):
10351044 ),
10361045 ) -> Index [complex ]: ...
10371046 @overload
1047+ def __rtruediv__ (
1048+ self : Index [int ] | Index [float ],
1049+ other : timedelta | np .timedelta64 | np_ndarray_td | TimedeltaIndex ,
1050+ ) -> TimedeltaIndex : ...
1051+ @overload
10381052 def __rtruediv__ (self , other : Path ) -> Index : ...
1053+ @overload
1054+ def __floordiv__ (self , other : Index [Never ]) -> Index : ...
1055+ @overload
10391056 def __floordiv__ (
1040- self , other : float | Sequence [float ] | Index [int ] | Index [float ]
1041- ) -> Self : ...
1057+ self : Index [int ] | Index [float ],
1058+ other : np_ndarray_complex | np_ndarray_dt | np_ndarray_td ,
1059+ ) -> Never : ...
1060+ @overload
1061+ def __floordiv__ (
1062+ self : Index [bool ] | Index [complex ], other : np_ndarray
1063+ ) -> Never : ...
1064+ @overload
1065+ def __floordiv__ (
1066+ self : Supports_ProtoFloorDiv [_T_contra , S2 ],
1067+ other : _T_contra | Sequence [_T_contra ],
1068+ ) -> Index [S2 ]: ...
1069+ @overload
1070+ def __floordiv__ (
1071+ self : Index [int ], other : np_ndarray_bool | Index [bool ]
1072+ ) -> Index [int ]: ...
1073+ @overload
1074+ def __floordiv__ (
1075+ self : Index [float ], other : np_ndarray_bool | Index [bool ]
1076+ ) -> Index [float ]: ...
1077+ @overload
1078+ def __floordiv__ (
1079+ self : Index [bool ] | Index [int ], other : np_ndarray_anyint | Index [int ]
1080+ ) -> Index [int ]: ...
1081+ @overload
1082+ def __floordiv__ (
1083+ self : Index [float ], other : np_ndarray_anyint | Index [int ]
1084+ ) -> Index [float ]: ...
1085+ @overload
1086+ def __floordiv__ (
1087+ self : Index [int ] | Index [float ],
1088+ other : float | Sequence [float ] | np_ndarray_float | Index [float ],
1089+ ) -> Index [float ]: ...
1090+ @overload
1091+ def __rfloordiv__ (self , other : Index [Never ]) -> Index : ... # type: ignore[overload-overlap]
1092+ @overload
10421093 def __rfloordiv__ (
1043- self , other : float | Sequence [float ] | Index [int ] | Index [float ]
1044- ) -> Self : ...
1094+ self : Index [int ] | Index [float ],
1095+ other : np_ndarray_complex | np_ndarray_dt | np_ndarray_td ,
1096+ ) -> Never : ...
1097+ @overload
1098+ def __rfloordiv__ (
1099+ self : Index [bool ] | Index [complex ], other : np_ndarray
1100+ ) -> Never : ...
1101+ @overload
1102+ def __rfloordiv__ (
1103+ self : Supports_ProtoRFloorDiv [_T_contra , S2 ],
1104+ other : _T_contra | Sequence [_T_contra ],
1105+ ) -> Index [S2 ]: ...
1106+ @overload
1107+ def __rfloordiv__ (
1108+ self : Index [int ], other : np_ndarray_bool | Index [bool ]
1109+ ) -> Index [int ]: ...
1110+ @overload
1111+ def __rfloordiv__ (
1112+ self : Index [float ], other : np_ndarray_bool | Index [bool ]
1113+ ) -> Index [float ]: ...
1114+ @overload
1115+ def __rfloordiv__ (
1116+ self : Index [bool ] | Index [int ], other : np_ndarray_anyint | Index [int ]
1117+ ) -> Index [int ]: ...
1118+ @overload
1119+ def __rfloordiv__ (
1120+ self : Index [float ], other : np_ndarray_anyint | Index [int ]
1121+ ) -> Index [float ]: ...
1122+ @overload
1123+ def __rfloordiv__ (
1124+ self : Index [int ] | Index [float ],
1125+ other : float | Sequence [float ] | np_ndarray_float | Index [float ],
1126+ ) -> Index [float ]: ...
1127+ @overload
1128+ def __rfloordiv__ (
1129+ self : Index [int ] | Index [float ],
1130+ other : timedelta | np_ndarray_td | TimedeltaIndex ,
1131+ ) -> TimedeltaIndex : ...
10451132 def infer_objects (self , copy : bool = True ) -> Self : ...
10461133
10471134@type_check_only
0 commit comments