Skip to content

Commit aa846a1

Browse files
GH1336 PR Feedback
1 parent 53573be commit aa846a1

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

pandas-stubs/_libs/tslibs/period.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class Period(PeriodMixin):
102102
@overload
103103
def __eq__(self, other: Period) -> bool: ... # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
104104
@overload
105-
def __eq__(self, other: PeriodIndex) -> np_1darray[np.bool]: ... # type: ignore[overload-overlap]
105+
def __eq__(self, other: Index) -> np_1darray[np.bool]: ... # type: ignore[overload-overlap]
106106
@overload
107107
def __eq__(self, other: PeriodSeries) -> Series[bool]: ... # type: ignore[overload-overlap]
108108
@overload
@@ -154,7 +154,7 @@ class Period(PeriodMixin):
154154
@overload
155155
def __ne__(self, other: Period) -> bool: ... # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
156156
@overload
157-
def __ne__(self, other: PeriodIndex) -> np_1darray[np.bool]: ... # type: ignore[overload-overlap]
157+
def __ne__(self, other: Index) -> np_1darray[np.bool]: ... # type: ignore[overload-overlap]
158158
@overload
159159
def __ne__(self, other: PeriodSeries) -> Series[bool]: ... # type: ignore[overload-overlap]
160160
@overload

pandas-stubs/_libs/tslibs/timedeltas.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ class Timedelta(timedelta):
311311
@overload
312312
def __eq__(self, other: TimedeltaSeries | Series[pd.Timedelta]) -> Series[bool]: ... # type: ignore[overload-overlap]
313313
@overload
314-
def __eq__(self, other: TimedeltaIndex) -> np_1darray[np.bool]: ... # type: ignore[overload-overlap]
314+
def __eq__(self, other: Index) -> np_1darray[np.bool]: ... # type: ignore[overload-overlap]
315315
@overload
316316
def __eq__( # type: ignore[overload-overlap]
317317
self, other: np_ndarray[ShapeT, np.timedelta64]
@@ -324,7 +324,7 @@ class Timedelta(timedelta):
324324
@overload
325325
def __ne__(self, other: TimedeltaSeries | Series[pd.Timedelta]) -> Series[bool]: ... # type: ignore[overload-overlap]
326326
@overload
327-
def __ne__(self, other: TimedeltaIndex) -> np_1darray[np.bool]: ... # type: ignore[overload-overlap]
327+
def __ne__(self, other: Index) -> np_1darray[np.bool]: ... # type: ignore[overload-overlap]
328328
@overload
329329
def __ne__( # type: ignore[overload-overlap]
330330
self, other: np_ndarray[ShapeT, np.timedelta64]

pandas-stubs/_libs/tslibs/timestamps.pyi

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ from pandas import (
2121
DatetimeIndex,
2222
TimedeltaIndex,
2323
)
24+
from pandas.core.indexes.base import Index
2425
from pandas.core.series import (
2526
Series,
2627
TimedeltaSeries,
@@ -256,7 +257,7 @@ class Timestamp(datetime, SupportsIndex):
256257
@overload
257258
def __eq__(self, other: TimestampSeries) -> Series[bool]: ... # type: ignore[overload-overlap]
258259
@overload
259-
def __eq__(self, other: DatetimeIndex) -> np_1darray[np.bool]: ... # type: ignore[overload-overlap]
260+
def __eq__(self, other: Index) -> np_1darray[np.bool]: ... # type: ignore[overload-overlap]
260261
@overload
261262
def __eq__(self, other: np_ndarray[ShapeT, np.datetime64]) -> np_ndarray[ShapeT, np.bool]: ... # type: ignore[overload-overlap]
262263
@overload
@@ -266,7 +267,7 @@ class Timestamp(datetime, SupportsIndex):
266267
@overload
267268
def __ne__(self, other: TimestampSeries) -> Series[bool]: ... # type: ignore[overload-overlap]
268269
@overload
269-
def __ne__(self, other: DatetimeIndex) -> np_1darray[np.bool]: ... # type: ignore[overload-overlap]
270+
def __ne__(self, other: Index) -> np_1darray[np.bool]: ... # type: ignore[overload-overlap]
270271
@overload
271272
def __ne__(self, other: np_ndarray[ShapeT, np.datetime64]) -> np_ndarray[ShapeT, np.bool]: ... # type: ignore[overload-overlap]
272273
@overload

tests/test_scalars.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,6 +1322,9 @@ def test_timestamp_cmp_index() -> None:
13221322
eq_dt1 = check(assert_type(ts == dt_idx, np_1darray[np.bool]), np_1darray[np.bool])
13231323
ne_dt1 = check(assert_type(ts != dt_idx, np_1darray[np.bool]), np_1darray[np.bool])
13241324
assert (eq_dt1 != ne_dt1).all()
1325+
eq_un1 = check(assert_type(ts == un_idx, np_1darray[np.bool]), np_1darray[np.bool]) # type: ignore[assert-type]
1326+
ne_un1 = check(assert_type(ts != un_idx, np_1darray[np.bool]), np_1darray[np.bool]) # type: ignore[assert-type]
1327+
assert (eq_un1 != ne_un1).all()
13251328

13261329
# ==, != (ts on the rhs, use == and != of lhs)
13271330
eq_rhs_dt1 = check(

0 commit comments

Comments
 (0)