Skip to content

Commit 23dd202

Browse files
committed
chore(comment): #1397 (comment)
1 parent f2b471c commit 23dd202

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

pandas-stubs/core/indexes/base.pyi

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,8 @@ class Index(IndexOpsMixin[S1]):
754754
def __mul__(self, other: np_ndarray_dt) -> Never: ...
755755
@overload
756756
def __mul__(self: Index[complex], other: np_ndarray_td) -> Never: ...
757-
# pandas-dev/pandas#62524
757+
# pandas-dev/pandas#62524: An index of Python native timedeltas can be
758+
# produced, instead of a TimedeltaIndex, hence the overload
758759
@overload
759760
def __mul__( # type: ignore[overload-overlap]
760761
self: Index[bool] | Index[int] | Index[float], other: Sequence[timedelta]
@@ -837,7 +838,8 @@ class Index(IndexOpsMixin[S1]):
837838
def __rmul__(self, other: np_ndarray_dt) -> Never: ...
838839
@overload
839840
def __rmul__(self: Index[complex], other: np_ndarray_td) -> Never: ...
840-
# pandas-dev/pandas#62524
841+
# pandas-dev/pandas#62524: An index of Python native timedeltas can be
842+
# produced, instead of a TimedeltaIndex, hence the overload
841843
@overload
842844
def __rmul__( # type: ignore[overload-overlap]
843845
self: Index[bool] | Index[int] | Index[float], other: Sequence[timedelta]

tests/indexes/arithmetic/int/test_mul.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ def test_mul_py_sequence(left: "pd.Index[int]") -> None:
6060
check(assert_type(left * c, "pd.Index[complex]"), pd.Index, np.complexfloating)
6161
if TYPE_CHECKING_INVALID_USAGE:
6262
_05 = left * s # type: ignore[operator] # pyright: ignore[reportOperatorIssue]
63-
# pandas-dev/pandas#62524
63+
# pandas-dev/pandas#62524: An index of Python native timedeltas can be
64+
# produced, instead of a TimedeltaIndex, hence the test
6465
check(assert_type(left * d, "pd.Index[pd.Timedelta]"), pd.Index, timedelta)
6566

6667
check(assert_type(b * left, "pd.Index[int]"), pd.Index, np.integer)
@@ -69,7 +70,8 @@ def test_mul_py_sequence(left: "pd.Index[int]") -> None:
6970
check(assert_type(c * left, "pd.Index[complex]"), pd.Index, np.complexfloating)
7071
if TYPE_CHECKING_INVALID_USAGE:
7172
_15 = s * left # type: ignore[operator] # pyright: ignore[reportOperatorIssue]
72-
# pandas-dev/pandas#62524
73+
# pandas-dev/pandas#62524: An index of Python native timedeltas can be
74+
# produced, instead of a TimedeltaIndex, hence the test
7375
check(assert_type(d * left, "pd.Index[pd.Timedelta]"), pd.Index, timedelta)
7476

7577

tests/indexes/arithmetic/timedelta/test_mul.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
@pytest.fixture
2020
def left() -> "pd.Index[pd.Timedelta]":
2121
"""left operand"""
22-
# pandas-dev/pandas#62524
22+
# pandas-dev/pandas#62524: An index of Python native timedeltas can be
23+
# produced, instead of a TimedeltaIndex, hence this test file
2324
lo = pd.Index([1]) * [timedelta(seconds=1)] # left operand
2425
return check(assert_type(lo, "pd.Index[pd.Timedelta]"), pd.Index, timedelta)
2526

0 commit comments

Comments
 (0)