Skip to content

Commit e378f44

Browse files
committed
Revert "remove irrelevant changes"
This reverts commit e0a8dca.
1 parent 827a9fe commit e378f44

2 files changed

Lines changed: 50 additions & 10 deletions

File tree

pandas-stubs/core/base.pyi

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ from pandas._libs.tslibs.timedeltas import Timedelta
3434
from pandas._typing import (
3535
S1,
3636
S2,
37+
S3,
3738
AxisIndex,
3839
DropKeep,
3940
DTypeLike,
@@ -390,6 +391,30 @@ class ElementOpsMixin(Generic[S2]):
390391
def _proto_rfloordiv(
391392
self: ElementOpsMixin[Timedelta], other: timedelta | np.timedelta64 | Timedelta
392393
) -> ElementOpsMixin[int]: ...
394+
@overload
395+
def _proto_mod(
396+
self: ElementOpsMixin[int], other: int | np.integer
397+
) -> ElementOpsMixin[int]: ...
398+
@overload
399+
def _proto_mod(
400+
self: ElementOpsMixin[float], other: float | np.floating
401+
) -> ElementOpsMixin[float]: ...
402+
@overload
403+
def _proto_mod(
404+
self: ElementOpsMixin[Timedelta], other: timedelta | np.timedelta64 | Timedelta
405+
) -> ElementOpsMixin[Timedelta]: ...
406+
@overload
407+
def _proto_rmod(
408+
self: ElementOpsMixin[int], other: int | np.integer
409+
) -> ElementOpsMixin[int]: ...
410+
@overload
411+
def _proto_rmod(
412+
self: ElementOpsMixin[float], other: float | np.floating
413+
) -> ElementOpsMixin[float]: ...
414+
@overload
415+
def _proto_rmod(
416+
self: ElementOpsMixin[Timedelta], other: timedelta | np.timedelta64 | Timedelta
417+
) -> ElementOpsMixin[Timedelta]: ...
393418

394419
@type_check_only
395420
class Supports_ProtoAdd(Protocol[T_contra, S2]):
@@ -422,3 +447,21 @@ class Supports_ProtoFloorDiv(Protocol[T_contra, S2]):
422447
@type_check_only
423448
class Supports_ProtoRFloorDiv(Protocol[T_contra, S2]):
424449
def _proto_rfloordiv(self, other: T_contra, /) -> ElementOpsMixin[S2]: ...
450+
451+
@type_check_only
452+
class Supports_ProtoMod(Protocol[T_contra, S2]):
453+
def _proto_mod(self, other: T_contra, /) -> ElementOpsMixin[S2]: ...
454+
455+
@type_check_only
456+
class Supports_ProtoRMod(Protocol[T_contra, S2]):
457+
def _proto_rmod(self, other: T_contra, /) -> ElementOpsMixin[S2]: ...
458+
459+
@type_check_only
460+
class Supports_ProtoDivMod(Protocol[T_contra, S2, S3]):
461+
def _proto_floordiv(self, other: T_contra, /) -> ElementOpsMixin[S2]: ...
462+
def _proto_mod(self, other: T_contra, /) -> ElementOpsMixin[S3]: ...
463+
464+
@type_check_only
465+
class Supports_ProtoRDivMod(Protocol[T_contra, S2, S3]):
466+
def _proto_rfloordiv(self, other: T_contra, /) -> ElementOpsMixin[S2]: ...
467+
def _proto_rmod(self, other: T_contra, /) -> ElementOpsMixin[S3]: ...

tests/test_natype.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,8 @@ def test_arithmetic() -> None:
8585
# __divmod__
8686
# bug upstream: https://github.com/pandas-dev/pandas/issues/62196
8787
# check(
88-
# assert_type(
89-
# divmod(na, s_int),
90-
# tuple[pd.Series, pd.Series],
91-
# ),
92-
# tuple,
88+
assert_type(divmod(na, s_int), tuple[pd.Series, pd.Series])
89+
# , tuple
9390
# )
9491
# check(
9592
# assert_type(
@@ -112,13 +109,13 @@ def test_arithmetic() -> None:
112109
# __rdivmod__
113110
# bug upstream: https://github.com/pandas-dev/pandas/issues/62196
114111
# check(
115-
# assert_type(divmod(s_int, na), tuple[pd.Series, pd.Series]),
116-
# tuple,
112+
assert_type(divmod(s_int, na), "tuple[pd.Series[int], pd.Series[int]]")
113+
# , tuple,
117114
# )
118-
# https://github.com/pandas-dev/pandas-stubs/issues/1347
115+
# bug upstream: https://github.com/pandas-dev/pandas/issues/62196
119116
# check(
120-
# assert_type(divmod(idx_int, na), tuple[pd.Index, pd.Index]),
121-
# tuple,
117+
assert_type(divmod(idx_int, na), "tuple[pd.Index[int], pd.Index[int]]")
118+
# , tuple,
122119
# )
123120
check(assert_type(divmod(1, na), tuple[NAType, NAType]), tuple)
124121

0 commit comments

Comments
 (0)