Skip to content

Commit c6cf1b3

Browse files
committed
Revert "remove irrelevant changes"
This reverts commit e0a8dca.
1 parent 7eb49da commit c6cf1b3

File tree

2 files changed

+50
-10
lines changed

2 files changed

+50
-10
lines changed

pandas-stubs/core/base.pyi

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ from pandas._libs.tslibs.timedeltas import Timedelta
3333
from pandas._typing import (
3434
S1,
3535
S2,
36+
S3,
3637
AxisIndex,
3738
DropKeep,
3839
DTypeLike,
@@ -387,6 +388,30 @@ class ElementOpsMixin(Generic[S2]):
387388
def _proto_rfloordiv(
388389
self: ElementOpsMixin[Timedelta], other: timedelta | np.timedelta64 | Timedelta
389390
) -> ElementOpsMixin[int]: ...
391+
@overload
392+
def _proto_mod(
393+
self: ElementOpsMixin[int], other: int | np.integer
394+
) -> ElementOpsMixin[int]: ...
395+
@overload
396+
def _proto_mod(
397+
self: ElementOpsMixin[float], other: float | np.floating
398+
) -> ElementOpsMixin[float]: ...
399+
@overload
400+
def _proto_mod(
401+
self: ElementOpsMixin[Timedelta], other: timedelta | np.timedelta64 | Timedelta
402+
) -> ElementOpsMixin[Timedelta]: ...
403+
@overload
404+
def _proto_rmod(
405+
self: ElementOpsMixin[int], other: int | np.integer
406+
) -> ElementOpsMixin[int]: ...
407+
@overload
408+
def _proto_rmod(
409+
self: ElementOpsMixin[float], other: float | np.floating
410+
) -> ElementOpsMixin[float]: ...
411+
@overload
412+
def _proto_rmod(
413+
self: ElementOpsMixin[Timedelta], other: timedelta | np.timedelta64 | Timedelta
414+
) -> ElementOpsMixin[Timedelta]: ...
390415

391416
@type_check_only
392417
class Supports_ProtoAdd(Protocol[T_contra, S2]):
@@ -419,3 +444,21 @@ class Supports_ProtoFloorDiv(Protocol[T_contra, S2]):
419444
@type_check_only
420445
class Supports_ProtoRFloorDiv(Protocol[T_contra, S2]):
421446
def _proto_rfloordiv(self, other: T_contra, /) -> ElementOpsMixin[S2]: ...
447+
448+
@type_check_only
449+
class Supports_ProtoMod(Protocol[T_contra, S2]):
450+
def _proto_mod(self, other: T_contra, /) -> ElementOpsMixin[S2]: ...
451+
452+
@type_check_only
453+
class Supports_ProtoRMod(Protocol[T_contra, S2]):
454+
def _proto_rmod(self, other: T_contra, /) -> ElementOpsMixin[S2]: ...
455+
456+
@type_check_only
457+
class Supports_ProtoDivMod(Protocol[T_contra, S2, S3]):
458+
def _proto_floordiv(self, other: T_contra, /) -> ElementOpsMixin[S2]: ...
459+
def _proto_mod(self, other: T_contra, /) -> ElementOpsMixin[S3]: ...
460+
461+
@type_check_only
462+
class Supports_ProtoRDivMod(Protocol[T_contra, S2, S3]):
463+
def _proto_rfloordiv(self, other: T_contra, /) -> ElementOpsMixin[S2]: ...
464+
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)