From b23d1aa693307e3b3ba73e6ab0b534bf443875a9 Mon Sep 17 00:00:00 2001 From: Adam Lippai Date: Sun, 13 Oct 2024 19:11:17 -0400 Subject: [PATCH] Ignore overload errors https://github.com/microsoft/pylance-release/issues/6512 --- pandas-stubs/_libs/tslibs/offsets.pyi | 6 +++--- tests/test_timefuncs.py | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pandas-stubs/_libs/tslibs/offsets.pyi b/pandas-stubs/_libs/tslibs/offsets.pyi index 19bfa36c..4b6a6123 100644 --- a/pandas-stubs/_libs/tslibs/offsets.pyi +++ b/pandas-stubs/_libs/tslibs/offsets.pyi @@ -43,7 +43,7 @@ class BaseOffset: @overload def __add__(self, other: npt.NDArray[np.object_]) -> npt.NDArray[np.object_]: ... @overload - def __add__(self, other: _DatetimeT) -> _DatetimeT: ... + def __add__(self, other: _DatetimeT) -> _DatetimeT: ... # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload] @overload def __add__(self, other: date) -> Timestamp: ... @overload @@ -53,7 +53,7 @@ class BaseOffset: @overload def __radd__(self, other: npt.NDArray[np.object_]) -> npt.NDArray[np.object_]: ... @overload - def __radd__(self, other: _DatetimeT) -> _DatetimeT: ... + def __radd__(self, other: _DatetimeT) -> _DatetimeT: ... # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload] @overload def __radd__(self, other: date) -> Timestamp: ... @overload @@ -64,7 +64,7 @@ class BaseOffset: @overload def __rsub__(self, other: npt.NDArray[np.object_]) -> npt.NDArray[np.object_]: ... @overload - def __rsub__(self, other: _DatetimeT) -> _DatetimeT: ... + def __rsub__(self, other: _DatetimeT) -> _DatetimeT: ... # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload] @overload def __rsub__(self, other: date) -> Timestamp: ... @overload diff --git a/tests/test_timefuncs.py b/tests/test_timefuncs.py index d1da094d..9722c314 100644 --- a/tests/test_timefuncs.py +++ b/tests/test_timefuncs.py @@ -668,6 +668,9 @@ def test_some_offsets() -> None: check(assert_type(dt.date.today() - Day(), pd.Timestamp), pd.Timestamp) check(assert_type(dt.date.today() + Day(), pd.Timestamp), pd.Timestamp) check(assert_type(Day() + dt.date.today(), pd.Timestamp), pd.Timestamp) + check(assert_type(dt.datetime.now() - Day(), dt.datetime), dt.datetime) + check(assert_type(dt.datetime.now() + Day(), dt.datetime), dt.datetime) + check(assert_type(Day() + dt.datetime.now(), dt.datetime), dt.datetime) # GH 235 check( assert_type(