Skip to content

Commit 68bbcf3

Browse files
committed
mypy fails
1 parent b5bb1d3 commit 68bbcf3

File tree

2 files changed

+10
-23
lines changed

2 files changed

+10
-23
lines changed

pandas-stubs/_libs/tslibs/timestamps.pyi

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ from datetime import (
77
tzinfo as _tzinfo,
88
)
99
from datetime import _IsoCalendarDate # pyright: ignore[reportPrivateUsage]
10-
import sys
1110
from time import struct_time
1211
from typing import (
1312
ClassVar,
@@ -99,16 +98,10 @@ class Timestamp(datetime, SupportsIndex):
9998
def tz(self) -> _tzinfo | None: ...
10099
@property
101100
def fold(self) -> int: ...
102-
103-
if sys.version_info >= (3, 12):
104-
@classmethod
105-
def fromtimestamp( # pyright: ignore[reportIncompatibleMethodOverride] # pyrefly: ignore
106-
cls, t: float, tz: _tzinfo | str | None = ...
107-
) -> Self: ...
108-
else:
109-
@classmethod
110-
def fromtimestamp(cls, t: float, tz: _tzinfo | str | None = ...) -> Self: ...
111-
101+
@classmethod
102+
def fromtimestamp( # pyright: ignore[reportIncompatibleMethodOverride]
103+
cls, t: float, tz: _tzinfo | str | None = ...
104+
) -> Self: ...
112105
@classmethod
113106
def utcfromtimestamp(cls, ts: float) -> Self: ...
114107
@classmethod
@@ -175,7 +168,7 @@ class Timestamp(datetime, SupportsIndex):
175168
# Mypy complains Forward operator "<inequality op>" is not callable, so ignore misc
176169
# for le, lt ge and gt
177170
@overload # type: ignore[override]
178-
def __le__(self, other: Timestamp | datetime | np.datetime64) -> bool: ...
171+
def __le__(self, other: datetime | np.datetime64 | Self) -> bool: ...
179172
@overload
180173
def __le__(self, other: DatetimeIndex) -> np_1darray[np.bool]: ...
181174
@overload
@@ -185,7 +178,7 @@ class Timestamp(datetime, SupportsIndex):
185178
@overload
186179
def __le__(self, other: Series[Timestamp]) -> Series[bool]: ...
187180
@overload # type: ignore[override]
188-
def __lt__(self, other: Timestamp | datetime | np.datetime64) -> bool: ...
181+
def __lt__(self, other: datetime | np.datetime64 | Self) -> bool: ...
189182
@overload
190183
def __lt__(self, other: DatetimeIndex) -> np_1darray[np.bool]: ...
191184
@overload
@@ -195,7 +188,7 @@ class Timestamp(datetime, SupportsIndex):
195188
@overload
196189
def __lt__(self, other: Series[Timestamp]) -> Series[bool]: ...
197190
@overload # type: ignore[override]
198-
def __ge__(self, other: Timestamp | datetime | np.datetime64) -> bool: ...
191+
def __ge__(self, other: datetime | np.datetime64 | Self) -> bool: ...
199192
@overload
200193
def __ge__(self, other: DatetimeIndex) -> np_1darray[np.bool]: ...
201194
@overload
@@ -205,7 +198,7 @@ class Timestamp(datetime, SupportsIndex):
205198
@overload
206199
def __ge__(self, other: Series[Timestamp]) -> Series[bool]: ...
207200
@overload # type: ignore[override]
208-
def __gt__(self, other: Timestamp | datetime | np.datetime64) -> bool: ...
201+
def __gt__(self, other: datetime | np.datetime64 | Self) -> bool: ...
209202
@overload
210203
def __gt__(self, other: DatetimeIndex) -> np_1darray[np.bool]: ...
211204
@overload
@@ -243,7 +236,7 @@ class Timestamp(datetime, SupportsIndex):
243236
self, other: np_ndarray[ShapeT, np.timedelta64]
244237
) -> np_ndarray[ShapeT, np.datetime64]: ...
245238
@overload
246-
def __eq__(self, other: Timestamp | datetime | np.datetime64) -> bool: ... # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
239+
def __eq__(self, other: datetime | np.datetime64 | Self) -> bool: ... # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
247240
@overload
248241
def __eq__(self, other: Series[Timestamp]) -> Series[bool]: ... # type: ignore[overload-overlap]
249242
@overload
@@ -253,7 +246,7 @@ class Timestamp(datetime, SupportsIndex):
253246
@overload
254247
def __eq__(self, other: object) -> Literal[False]: ...
255248
@overload
256-
def __ne__(self, other: Timestamp | datetime | np.datetime64) -> bool: ... # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
249+
def __ne__(self, other: datetime | np.datetime64 | Self) -> bool: ... # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
257250
@overload
258251
def __ne__(self, other: Series[Timestamp]) -> Series[bool]: ... # type: ignore[overload-overlap]
259252
@overload

tests/scalars/test_scalars.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -755,8 +755,6 @@ def test_timedelta_mul_div() -> None:
755755
np.ndarray,
756756
np.timedelta64,
757757
)
758-
# check(assert_type(td / md_int64_index, pd.TimedeltaIndex), pd.TimedeltaIndex)
759-
# check(assert_type(td / md_float_index, pd.TimedeltaIndex), pd.TimedeltaIndex)
760758

761759
check(assert_type(pd.NaT / td, float), float)
762760
# Note: None of the reverse truediv work
@@ -767,10 +765,6 @@ def test_timedelta_mul_div() -> None:
767765
_11 = md_float / td # type: ignore[operator] # pyright: ignore[reportOperatorIssue]
768766
_12 = md_ndarray_intp / td # type: ignore[operator] # pyright: ignore[reportOperatorIssue]
769767
_13 = md_ndarray_float / td # type: ignore[operator] # pyright: ignore[reportOperatorIssue]
770-
_14 = mp_series_int / td # type: ignore[operator] # pyright: ignore[reportOperatorIssue]
771-
_15 = md_series_float / td # type: ignore[operator] # pyright: ignore[reportOperatorIssue]
772-
_16 = (md_int64_index / td,) # type: ignore[operator] # pyright: ignore[reportOperatorIssue]
773-
_17 = (md_float_index / td,) # type: ignore[operator] # pyright: ignore[reportOperatorIssue]
774768

775769

776770
def test_timedelta_mod_abs_unary() -> None:

0 commit comments

Comments
 (0)