Skip to content

Commit 9af8c9e

Browse files
committed
mypy happiness
1 parent 7fd2f70 commit 9af8c9e

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

pandas-stubs/_libs/tslibs/period.pyi

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -91,19 +91,9 @@ class Period(PeriodMixin):
9191
@overload
9292
def __add__(self, other: NaTType) -> NaTType: ...
9393
@overload
94-
def __add__(self, other: Index) -> PeriodIndex: ...
95-
# Ignored due to indecipherable error from mypy:
96-
# Forward operator "__add__" is not callable [misc]
97-
@overload
9894
def __radd__(self, other: _PeriodAddSub) -> Self: ...
9995
@overload
10096
def __radd__(self, other: NaTType) -> NaTType: ...
101-
# Real signature is -> PeriodIndex, but conflicts with Index.__add__
102-
# Changing Index is very hard due to Index inheritance
103-
# Signatures of "__radd__" of "Period" and "__add__" of "Index"
104-
# are unsafely overlapping
105-
@overload
106-
def __radd__(self, other: Index) -> PeriodIndex: ...
10797
# ignore[misc] here because we know all other comparisons
10898
# are False, so we use Literal[False]
10999
@overload

pandas-stubs/core/indexes/base.pyi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,8 @@ class Index(IndexOpsMixin[S1], ElementOpsMixin[S1]):
510510
@overload
511511
def __add__(self, other: Index[Never]) -> Index: ...
512512
@overload
513+
def __add__(self: Index[Never], other: Period) -> PeriodIndex: ...
514+
@overload
513515
def __add__(
514516
self: Supports_ProtoAdd[_T_contra, S2], other: _T_contra | Sequence[_T_contra]
515517
) -> Index[S2]: ...
@@ -558,6 +560,8 @@ class Index(IndexOpsMixin[S1], ElementOpsMixin[S1]):
558560
@overload
559561
def __radd__(self: Index[Never], other: complex | _ListLike | Index) -> Index: ...
560562
@overload
563+
def __radd__(self: Index[Never], other: Period) -> PeriodIndex: ...
564+
@overload
561565
def __radd__(
562566
self: Supports_ProtoRAdd[_T_contra, S2],
563567
other: _T_contra | Sequence[_T_contra],

0 commit comments

Comments
 (0)