Skip to content

Commit 8367694

Browse files
committed
Revert "remove irrelevant changes"
This reverts commit e0a8dca.
1 parent 38b46dc commit 8367694

File tree

2 files changed

+50
-9
lines changed

2 files changed

+50
-9
lines changed

pandas-stubs/core/base.pyi

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ from pandas._libs.tslibs.timedeltas import Timedelta
2929
from pandas._typing import (
3030
S1,
3131
S2,
32+
S3,
3233
AxisIndex,
3334
DropKeep,
3435
DTypeLike,
@@ -322,6 +323,30 @@ class ElementOpsMixin(Generic[S2]):
322323
def _proto_rfloordiv(
323324
self: ElementOpsMixin[Timedelta], other: timedelta | np.timedelta64 | Timedelta
324325
) -> ElementOpsMixin[int]: ...
326+
@overload
327+
def _proto_mod(
328+
self: ElementOpsMixin[int], other: int | np.integer
329+
) -> ElementOpsMixin[int]: ...
330+
@overload
331+
def _proto_mod(
332+
self: ElementOpsMixin[float], other: float | np.floating
333+
) -> ElementOpsMixin[float]: ...
334+
@overload
335+
def _proto_mod(
336+
self: ElementOpsMixin[Timedelta], other: timedelta | np.timedelta64 | Timedelta
337+
) -> ElementOpsMixin[Timedelta]: ...
338+
@overload
339+
def _proto_rmod(
340+
self: ElementOpsMixin[int], other: int | np.integer
341+
) -> ElementOpsMixin[int]: ...
342+
@overload
343+
def _proto_rmod(
344+
self: ElementOpsMixin[float], other: float | np.floating
345+
) -> ElementOpsMixin[float]: ...
346+
@overload
347+
def _proto_rmod(
348+
self: ElementOpsMixin[Timedelta], other: timedelta | np.timedelta64 | Timedelta
349+
) -> ElementOpsMixin[Timedelta]: ...
325350

326351
@type_check_only
327352
class Supports_ProtoAdd(Protocol[_T_contra, S2]):
@@ -354,3 +379,21 @@ class Supports_ProtoFloorDiv(Protocol[_T_contra, S2]):
354379
@type_check_only
355380
class Supports_ProtoRFloorDiv(Protocol[_T_contra, S2]):
356381
def _proto_rfloordiv(self, other: _T_contra, /) -> ElementOpsMixin[S2]: ...
382+
383+
@type_check_only
384+
class Supports_ProtoMod(Protocol[_T_contra, S2]):
385+
def _proto_mod(self, other: _T_contra, /) -> ElementOpsMixin[S2]: ...
386+
387+
@type_check_only
388+
class Supports_ProtoRMod(Protocol[_T_contra, S2]):
389+
def _proto_rmod(self, other: _T_contra, /) -> ElementOpsMixin[S2]: ...
390+
391+
@type_check_only
392+
class Supports_ProtoDivMod(Protocol[_T_contra, S2, S3]):
393+
def _proto_floordiv(self, other: _T_contra, /) -> ElementOpsMixin[S2]: ...
394+
def _proto_mod(self, other: _T_contra, /) -> ElementOpsMixin[S3]: ...
395+
396+
@type_check_only
397+
class Supports_ProtoRDivMod(Protocol[_T_contra, S2, S3]):
398+
def _proto_rfloordiv(self, other: _T_contra, /) -> ElementOpsMixin[S2]: ...
399+
def _proto_rmod(self, other: _T_contra, /) -> ElementOpsMixin[S3]: ...

tests/test_natype.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,8 @@ def test_arithmetic() -> None:
8383
# __divmod__
8484
# bug upstream: https://github.com/pandas-dev/pandas/issues/62196
8585
# check(
86-
# assert_type(
87-
# divmod(na, s_int),
88-
# tuple[pd.Series, pd.Series],
89-
# ),
90-
# tuple,
86+
assert_type(divmod(na, s_int), tuple[pd.Series, pd.Series])
87+
# , tuple
9188
# )
9289
# check(
9390
# assert_type(
@@ -110,12 +107,13 @@ def test_arithmetic() -> None:
110107
# __rdivmod__
111108
# bug upstream: https://github.com/pandas-dev/pandas/issues/62196
112109
# check(
113-
# assert_type(divmod(s_int, na), tuple[pd.Series, pd.Series]),
114-
# tuple,
110+
assert_type(divmod(s_int, na), "tuple[pd.Series[int], pd.Series[int]]")
111+
# , tuple,
115112
# )
116-
# https://github.com/pandas-dev/pandas-stubs/issues/1347
113+
# bug upstream: https://github.com/pandas-dev/pandas/issues/62196
117114
# check(
118-
# assert_type(divmod(idx_int, na), tuple[pd.Index, pd.Index]),
115+
assert_type(divmod(idx_int, na), "tuple[pd.Index[int], pd.Index[int]]")
116+
# , tuple,
119117
# )
120118
check(assert_type(divmod(1, na), tuple[NAType, NAType]), tuple)
121119

0 commit comments

Comments
 (0)