Skip to content

Commit 8a0dcbd

Browse files
committed
fix(comment): #1350 (review)
1 parent 1a1ff50 commit 8a0dcbd

File tree

5 files changed

+11
-13
lines changed

5 files changed

+11
-13
lines changed

pandas-stubs/core/arraylike.pyi

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ class OpsMixin:
1919
def __rxor__(self, other: Any) -> Self: ...
2020
# -------------------------------------------------------------
2121
# Arithmetic Methods
22-
def __add__(self, other: Any) -> Self: ...
23-
def __radd__(self, other: Any) -> Self: ...
2422
def __sub__(self, other: Any) -> Self: ...
2523
def __rsub__(self, other: Any) -> Self: ...
2624
def __mul__(self, other: Any) -> Self: ...

pandas-stubs/core/frame.pyi

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1772,13 +1772,22 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
17721772
# methods
17731773
@final
17741774
def abs(self) -> Self: ...
1775+
def __add__(self, other: Any) -> Self: ...
17751776
def add(
17761777
self,
17771778
other: num | ListLike | DataFrame,
17781779
axis: Axis | None = "columns",
17791780
level: Level | None = None,
17801781
fill_value: float | None = None,
17811782
) -> Self: ...
1783+
def __radd__(self, other: Any) -> Self: ...
1784+
def radd(
1785+
self,
1786+
other,
1787+
axis: Axis = "columns",
1788+
level: Level | None = None,
1789+
fill_value: float | None = None,
1790+
) -> Self: ...
17821791
@final
17831792
def add_prefix(self, prefix: _str, axis: Axis | None = None) -> Self: ...
17841793
@final
@@ -2222,13 +2231,6 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
22222231
min_count: int = 0,
22232232
**kwargs: Any,
22242233
) -> Series: ...
2225-
def radd(
2226-
self,
2227-
other,
2228-
axis: Axis = "columns",
2229-
level: Level | None = None,
2230-
fill_value: float | None = None,
2231-
) -> Self: ...
22322234
@final
22332235
def rank(
22342236
self,

pandas-stubs/core/indexes/base.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ class Index(IndexOpsMixin[S1]):
554554
def __add__(
555555
self: Index[_str], other: _str | Sequence[_str] | np_ndarray_str | Index[_str]
556556
) -> Index[_str]: ...
557-
@overload # type: ignore[override]
557+
@overload
558558
def __radd__(self: Index[Never], other: _str) -> Never: ...
559559
@overload
560560
def __radd__(self: Index[Never], other: complex | _ListLike | Index) -> Index: ...

pandas-stubs/core/series.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1876,7 +1876,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
18761876
fill_value: float | None = None,
18771877
axis: int = 0,
18781878
) -> Series[_str]: ...
1879-
@overload # type: ignore[override]
1879+
@overload
18801880
def __radd__(self: Series[Never], other: _str) -> Never: ...
18811881
@overload
18821882
def __radd__(

tests/indexes/test_indexes.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,12 +262,10 @@ def test_types_to_numpy() -> None:
262262
def test_index_arithmetic() -> None:
263263
# GH 287
264264
idx = pd.Index([1, 2.2, 3], dtype=float)
265-
check(assert_type(idx + 3, "pd.Index[float]"), pd.Index, np.float64)
266265
check(assert_type(idx - 3, "pd.Index[float]"), pd.Index, np.float64)
267266
check(assert_type(idx * 3, "pd.Index[float]"), pd.Index, np.float64)
268267
check(assert_type(idx / 3, "pd.Index[float]"), pd.Index, np.float64)
269268
check(assert_type(idx // 3, "pd.Index[float]"), pd.Index, np.float64)
270-
check(assert_type(3 + idx, "pd.Index[float]"), pd.Index, np.float64)
271269
check(assert_type(3 - idx, "pd.Index[float]"), pd.Index, np.float64)
272270
check(assert_type(3 * idx, "pd.Index[float]"), pd.Index, np.float64)
273271
check(assert_type(3 / idx, "pd.Index[float]"), pd.Index, np.float64)

0 commit comments

Comments
 (0)