@@ -22,7 +22,11 @@ from typing_extensions import TypeAlias
2222from pandas ._libs .tslibs import NaTType
2323from pandas ._libs .tslibs .offsets import BaseOffset
2424from pandas ._libs .tslibs .timestamps import Timestamp
25- from pandas ._typing import npt
25+ from pandas ._typing import (
26+ ShapeT ,
27+ np_1darray ,
28+ np_ndarray ,
29+ )
2630
2731class IncompatibleFrequency (ValueError ): ...
2832
@@ -98,44 +102,64 @@ class Period(PeriodMixin):
98102 @overload
99103 def __eq__ (self , other : Period ) -> bool : ... # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
100104 @overload
101- def __eq__ (self , other : PeriodIndex ) -> npt . NDArray [np .bool_ ]: ... # type: ignore[overload-overlap]
105+ def __eq__ (self , other : PeriodIndex ) -> np_1darray [np .bool ]: ... # type: ignore[overload-overlap]
102106 @overload
103107 def __eq__ (self , other : PeriodSeries ) -> Series [bool ]: ... # type: ignore[overload-overlap]
104108 @overload
109+ def __eq__ (self , other : np_ndarray [ShapeT , np .object_ ]) -> np_ndarray [ShapeT , np .bool ]: ... # type: ignore[overload-overlap]
110+ @overload
105111 def __eq__ (self , other : object ) -> Literal [False ]: ...
106112 @overload
107113 def __ge__ (self , other : Period ) -> bool : ...
108114 @overload
109- def __ge__ (self , other : PeriodIndex ) -> npt . NDArray [np .bool_ ]: ...
115+ def __ge__ (self , other : PeriodIndex ) -> np_1darray [np .bool ]: ...
110116 @overload
111117 def __ge__ (self , other : PeriodSeries ) -> Series [bool ]: ...
112118 @overload
119+ def __ge__ (
120+ self , other : np_ndarray [ShapeT , np .object_ ]
121+ ) -> np_ndarray [ShapeT , np .bool ]: ...
122+ @overload
113123 def __gt__ (self , other : Period ) -> bool : ...
114124 @overload
115- def __gt__ (self , other : PeriodIndex ) -> npt . NDArray [np .bool_ ]: ...
125+ def __gt__ (self , other : PeriodIndex ) -> np_1darray [np .bool ]: ...
116126 @overload
117127 def __gt__ (self , other : PeriodSeries ) -> Series [bool ]: ...
118128 @overload
129+ def __gt__ (
130+ self , other : np_ndarray [ShapeT , np .object_ ]
131+ ) -> np_ndarray [ShapeT , np .bool ]: ...
132+ @overload
119133 def __le__ (self , other : Period ) -> bool : ...
120134 @overload
121- def __le__ (self , other : PeriodIndex ) -> npt . NDArray [np .bool_ ]: ...
135+ def __le__ (self , other : PeriodIndex ) -> np_1darray [np .bool ]: ...
122136 @overload
123137 def __le__ (self , other : PeriodSeries ) -> Series [bool ]: ...
124138 @overload
139+ def __le__ (
140+ self , other : np_ndarray [ShapeT , np .object_ ]
141+ ) -> np_ndarray [ShapeT , np .bool ]: ...
142+ @overload
125143 def __lt__ (self , other : Period ) -> bool : ...
126144 @overload
127- def __lt__ (self , other : PeriodIndex ) -> npt . NDArray [np .bool_ ]: ...
145+ def __lt__ (self , other : PeriodIndex ) -> np_1darray [np .bool ]: ...
128146 @overload
129147 def __lt__ (self , other : PeriodSeries ) -> Series [bool ]: ...
148+ @overload
149+ def __lt__ (
150+ self , other : np_ndarray [ShapeT , np .object_ ]
151+ ) -> np_ndarray [ShapeT , np .bool ]: ...
130152 # ignore[misc] here because we know all other comparisons
131153 # are False, so we use Literal[False]
132154 @overload
133155 def __ne__ (self , other : Period ) -> bool : ... # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
134156 @overload
135- def __ne__ (self , other : PeriodIndex ) -> npt . NDArray [np .bool_ ]: ... # type: ignore[overload-overlap]
157+ def __ne__ (self , other : PeriodIndex ) -> np_1darray [np .bool ]: ... # type: ignore[overload-overlap]
136158 @overload
137159 def __ne__ (self , other : PeriodSeries ) -> Series [bool ]: ... # type: ignore[overload-overlap]
138160 @overload
161+ def __ne__ (self , other : np_ndarray [ShapeT , np .object_ ]) -> np_ndarray [ShapeT , np .bool ]: ... # type: ignore[overload-overlap]
162+ @overload
139163 def __ne__ (self , other : object ) -> Literal [True ]: ...
140164 # Ignored due to indecipherable error from mypy:
141165 # Forward operator "__add__" is not callable [misc]
0 commit comments