@@ -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 ,
@@ -92,6 +93,7 @@ from pandas._typing import (
9293 TimedeltaDtypeArg ,
9394 TimestampDtypeArg ,
9495 np_1darray ,
96+ np_ndarray ,
9597 np_ndarray_anyint ,
9698 np_ndarray_bool ,
9799 np_ndarray_complex ,
@@ -102,6 +104,8 @@ from pandas._typing import (
102104 type_t ,
103105)
104106
107+ from pandas .core .dtypes .dtypes import PeriodDtype
108+
105109class InvalidIndexError (Exception ): ...
106110
107111class Index (IndexOpsMixin [S1 ], ElementOpsMixin [S1 ]):
@@ -894,14 +898,17 @@ class Index(IndexOpsMixin[S1], ElementOpsMixin[S1]):
894898 @overload
895899 def __truediv__ (self : Index [bool ], other : np_ndarray_bool ) -> Never : ...
896900 @overload
901+ def __truediv__ (self , other : np_ndarray_dt ) -> Never : ...
902+ @overload
903+ def __truediv__ (self : Index [T_COMPLEX ], other : np_ndarray_td ) -> Never : ...
904+ @overload
897905 def __truediv__ (
898906 self : Supports_ProtoTrueDiv [_T_contra , S2 ],
899907 other : _T_contra | Sequence [_T_contra ],
900908 ) -> Index [S2 ]: ...
901909 @overload
902910 def __truediv__ (
903- self : Index [int ],
904- other : np_ndarray_bool | Index [bool ],
911+ self : Index [int ], other : np_ndarray_bool | Index [bool ]
905912 ) -> Index [float ]: ...
906913 @overload
907914 def __truediv__ (
@@ -945,10 +952,12 @@ class Index(IndexOpsMixin[S1], ElementOpsMixin[S1]):
945952 self : Index [Never ], other : complex | ArrayLike | SequenceNotStr [S1 ] | Index
946953 ) -> Index : ...
947954 @overload
948- def __rtruediv__ (self , other : Index [Never ]) -> Index : ...
955+ def __rtruediv__ (self , other : Index [Never ]) -> Index : ... # type: ignore[overload-overlap]
949956 @overload
950957 def __rtruediv__ (self : Index [bool ], other : np_ndarray_bool ) -> Never : ...
951958 @overload
959+ def __rtruediv__ (self , other : np_ndarray_dt ) -> Never : ...
960+ @overload
952961 def __rtruediv__ (
953962 self : Supports_ProtoRTrueDiv [_T_contra , S2 ],
954963 other : _T_contra | Sequence [_T_contra ],
@@ -993,13 +1002,91 @@ class Index(IndexOpsMixin[S1], ElementOpsMixin[S1]):
9931002 ),
9941003 ) -> Index [complex ]: ...
9951004 @overload
1005+ def __rtruediv__ (
1006+ self : Index [int ] | Index [float ],
1007+ other : timedelta | np .timedelta64 | np_ndarray_td | TimedeltaIndex ,
1008+ ) -> TimedeltaIndex : ...
1009+ @overload
9961010 def __rtruediv__ (self , other : Path ) -> Index : ...
1011+ @overload
1012+ def __floordiv__ (self , other : Index [Never ]) -> Index : ...
1013+ @overload
9971014 def __floordiv__ (
998- self , other : float | Sequence [float ] | Index [int ] | Index [float ]
999- ) -> Self : ...
1015+ self : Index [int ] | Index [float ],
1016+ other : np_ndarray_complex | np_ndarray_dt | np_ndarray_td ,
1017+ ) -> Never : ...
1018+ @overload
1019+ def __floordiv__ (
1020+ self : Index [bool ] | Index [complex ], other : np_ndarray
1021+ ) -> Never : ...
1022+ @overload
1023+ def __floordiv__ (
1024+ self : Supports_ProtoFloorDiv [_T_contra , S2 ],
1025+ other : _T_contra | Sequence [_T_contra ],
1026+ ) -> Index [S2 ]: ...
1027+ @overload
1028+ def __floordiv__ (
1029+ self : Index [int ], other : np_ndarray_bool | Index [bool ]
1030+ ) -> Index [int ]: ...
1031+ @overload
1032+ def __floordiv__ (
1033+ self : Index [float ], other : np_ndarray_bool | Index [bool ]
1034+ ) -> Index [float ]: ...
1035+ @overload
1036+ def __floordiv__ (
1037+ self : Index [bool ] | Index [int ], other : np_ndarray_anyint | Index [int ]
1038+ ) -> Index [int ]: ...
1039+ @overload
1040+ def __floordiv__ (
1041+ self : Index [float ], other : np_ndarray_anyint | Index [int ]
1042+ ) -> Index [float ]: ...
1043+ @overload
1044+ def __floordiv__ (
1045+ self : Index [int ] | Index [float ],
1046+ other : float | Sequence [float ] | np_ndarray_float | Index [float ],
1047+ ) -> Index [float ]: ...
1048+ @overload
1049+ def __rfloordiv__ (self , other : Index [Never ]) -> Index : ... # type: ignore[overload-overlap]
1050+ @overload
10001051 def __rfloordiv__ (
1001- self , other : float | Sequence [float ] | Index [int ] | Index [float ]
1002- ) -> Self : ...
1052+ self : Index [int ] | Index [float ],
1053+ other : np_ndarray_complex | np_ndarray_dt | np_ndarray_td ,
1054+ ) -> Never : ...
1055+ @overload
1056+ def __rfloordiv__ (
1057+ self : Index [bool ] | Index [complex ], other : np_ndarray
1058+ ) -> Never : ...
1059+ @overload
1060+ def __rfloordiv__ (
1061+ self : Supports_ProtoRFloorDiv [_T_contra , S2 ],
1062+ other : _T_contra | Sequence [_T_contra ],
1063+ ) -> Index [S2 ]: ...
1064+ @overload
1065+ def __rfloordiv__ (
1066+ self : Index [int ], other : np_ndarray_bool | Index [bool ]
1067+ ) -> Index [int ]: ...
1068+ @overload
1069+ def __rfloordiv__ (
1070+ self : Index [float ], other : np_ndarray_bool | Index [bool ]
1071+ ) -> Index [float ]: ...
1072+ @overload
1073+ def __rfloordiv__ (
1074+ self : Index [bool ] | Index [int ], other : np_ndarray_anyint | Index [int ]
1075+ ) -> Index [int ]: ...
1076+ @overload
1077+ def __rfloordiv__ (
1078+ self : Index [float ], other : np_ndarray_anyint | Index [int ]
1079+ ) -> Index [float ]: ...
1080+ @overload
1081+ def __rfloordiv__ (
1082+ self : Index [int ] | Index [float ],
1083+ other : float | Sequence [float ] | np_ndarray_float | Index [float ],
1084+ ) -> Index [float ]: ...
1085+ @overload
1086+ def __rfloordiv__ (
1087+ self : Index [int ] | Index [float ],
1088+ other : timedelta | np_ndarray_td | TimedeltaIndex ,
1089+ ) -> TimedeltaIndex : ...
10031090 def infer_objects (self , copy : bool = True ) -> Self : ...
10041091
10051092@type_check_only
0 commit comments