Skip to content

Commit 8a07eca

Browse files
committed
fix(comment): #1274 (comment)
1 parent dd8baff commit 8a07eca

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

pandas-stubs/core/series.pyi

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1945,11 +1945,18 @@ class Series(IndexOpsMixin[S1], NDFrame):
19451945
) -> Series[Timestamp]: ...
19461946
@overload
19471947
def __mul__(
1948-
self: Series[Timestamp], other: _nonseries_timedelta | TimedeltaSeries
1949-
) -> Never: ...
1948+
self: Series[int],
1949+
other: timedelta | Timedelta | TimedeltaSeries | np.timedelta64,
1950+
) -> TimedeltaSeries: ...
19501951
@overload
19511952
def __mul__(
1952-
self, other: timedelta | Timedelta | TimedeltaSeries | np.timedelta64
1953+
self: Series[float],
1954+
other: timedelta | Timedelta | TimedeltaSeries | np.timedelta64,
1955+
) -> TimedeltaSeries: ...
1956+
@overload
1957+
def __mul__(
1958+
self: Series[bool],
1959+
other: timedelta | Timedelta | TimedeltaSeries | np.timedelta64,
19531960
) -> TimedeltaSeries: ...
19541961
@overload
19551962
def __mul__(self, other: num | _ListLike | Series) -> Series: ...

tests/test_timefuncs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1430,7 +1430,7 @@ def test_timedelta64_and_arithmatic_operator() -> None:
14301430
check(assert_type((s3 + td), "TimedeltaSeries"), pd.Series, pd.Timedelta)
14311431
check(assert_type((s3 / td), "pd.Series[float]"), pd.Series, float)
14321432
if TYPE_CHECKING_INVALID_USAGE:
1433-
r1 = s1 * td # type: ignore[var-annotated]
1433+
r1 = s1 * td # type: ignore[operator] # pyright: ignore[reportOperatorIssue]
14341434
r2 = s1 / td # type: ignore[operator] # pyright: ignore[reportOperatorIssue]
14351435
r3 = s3 * td # type: ignore[operator] # pyright: ignore[reportOperatorIssue]
14361436

0 commit comments

Comments
 (0)