@@ -22,7 +22,11 @@ from typing_extensions import TypeAlias
22
22
from pandas ._libs .tslibs import NaTType
23
23
from pandas ._libs .tslibs .offsets import BaseOffset
24
24
from 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
+ )
26
30
27
31
class IncompatibleFrequency (ValueError ): ...
28
32
@@ -98,44 +102,64 @@ class Period(PeriodMixin):
98
102
@overload
99
103
def __eq__ (self , other : Period ) -> bool : ... # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
100
104
@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]
102
106
@overload
103
107
def __eq__ (self , other : PeriodSeries ) -> Series [bool ]: ... # type: ignore[overload-overlap]
104
108
@overload
109
+ def __eq__ (self , other : np_ndarray [ShapeT , np .object_ ]) -> np_ndarray [ShapeT , np .bool ]: ... # type: ignore[overload-overlap]
110
+ @overload
105
111
def __eq__ (self , other : object ) -> Literal [False ]: ...
106
112
@overload
107
113
def __ge__ (self , other : Period ) -> bool : ...
108
114
@overload
109
- def __ge__ (self , other : PeriodIndex ) -> npt . NDArray [np .bool_ ]: ...
115
+ def __ge__ (self , other : PeriodIndex ) -> np_1darray [np .bool ]: ...
110
116
@overload
111
117
def __ge__ (self , other : PeriodSeries ) -> Series [bool ]: ...
112
118
@overload
119
+ def __ge__ (
120
+ self , other : np_ndarray [ShapeT , np .object_ ]
121
+ ) -> np_ndarray [ShapeT , np .bool ]: ...
122
+ @overload
113
123
def __gt__ (self , other : Period ) -> bool : ...
114
124
@overload
115
- def __gt__ (self , other : PeriodIndex ) -> npt . NDArray [np .bool_ ]: ...
125
+ def __gt__ (self , other : PeriodIndex ) -> np_1darray [np .bool ]: ...
116
126
@overload
117
127
def __gt__ (self , other : PeriodSeries ) -> Series [bool ]: ...
118
128
@overload
129
+ def __gt__ (
130
+ self , other : np_ndarray [ShapeT , np .object_ ]
131
+ ) -> np_ndarray [ShapeT , np .bool ]: ...
132
+ @overload
119
133
def __le__ (self , other : Period ) -> bool : ...
120
134
@overload
121
- def __le__ (self , other : PeriodIndex ) -> npt . NDArray [np .bool_ ]: ...
135
+ def __le__ (self , other : PeriodIndex ) -> np_1darray [np .bool ]: ...
122
136
@overload
123
137
def __le__ (self , other : PeriodSeries ) -> Series [bool ]: ...
124
138
@overload
139
+ def __le__ (
140
+ self , other : np_ndarray [ShapeT , np .object_ ]
141
+ ) -> np_ndarray [ShapeT , np .bool ]: ...
142
+ @overload
125
143
def __lt__ (self , other : Period ) -> bool : ...
126
144
@overload
127
- def __lt__ (self , other : PeriodIndex ) -> npt . NDArray [np .bool_ ]: ...
145
+ def __lt__ (self , other : PeriodIndex ) -> np_1darray [np .bool ]: ...
128
146
@overload
129
147
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 ]: ...
130
152
# ignore[misc] here because we know all other comparisons
131
153
# are False, so we use Literal[False]
132
154
@overload
133
155
def __ne__ (self , other : Period ) -> bool : ... # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
134
156
@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]
136
158
@overload
137
159
def __ne__ (self , other : PeriodSeries ) -> Series [bool ]: ... # type: ignore[overload-overlap]
138
160
@overload
161
+ def __ne__ (self , other : np_ndarray [ShapeT , np .object_ ]) -> np_ndarray [ShapeT , np .bool ]: ... # type: ignore[overload-overlap]
162
+ @overload
139
163
def __ne__ (self , other : object ) -> Literal [True ]: ...
140
164
# Ignored due to indecipherable error from mypy:
141
165
# Forward operator "__add__" is not callable [misc]
0 commit comments