Skip to content

Commit 79ae3a9

Browse files
committed
fix: #718 ty
1 parent e5b7b1e commit 79ae3a9

File tree

2 files changed

+20
-14
lines changed

2 files changed

+20
-14
lines changed

pandas-stubs/_libs/tslibs/timedeltas.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ class Timedelta(timedelta):
297297
@overload
298298
def __eq__(self, other: timedelta | Timedelta | np.timedelta64) -> bool: ... # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
299299
@overload
300-
def __eq__(self, other: Series[Timedelta] | Series[pd.Timedelta]) -> Series[bool]: ... # type: ignore[overload-overlap]
300+
def __eq__(self, other: Series[Timedelta]) -> Series[bool]: ... # type: ignore[overload-overlap]
301301
@overload
302302
def __eq__( # type: ignore[overload-overlap]
303303
self, other: TimedeltaIndex | npt.NDArray[np.timedelta64]

pandas-stubs/core/series.pyi

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ _vector_timedelta: TypeAlias = (
187187
Sequence[timedelta] | Sequence[Timedelta] | TimedeltaIndex
188188
)
189189
_nonseries_timedelta: TypeAlias = _scalar_timedelta | _vector_timedelta
190-
_all_int: TypeAlias = int | np_ndarray_anyint | Series[int] | Sequence[int]
190+
_nonseries_int: TypeAlias = int | np_ndarray_anyint | Sequence[int]
191191

192192
_T_INT = TypeVar("_T_INT", bound=int)
193193
_T_STAMP_AND_DELTA = TypeVar("_T_STAMP_AND_DELTA", bound=Timestamp | Timedelta)
@@ -819,7 +819,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
819819
@overload
820820
def diff(self: Series[_str], periods: int = ...) -> Never: ...
821821
@overload
822-
def diff(self: Series[Timestamp] | Series[Timedelta], periods: int = ...) -> Series[Timedelta]: ... # type: ignore[overload-overlap]
822+
def diff(self: Series[_T_STAMP_AND_DELTA], periods: int = ...) -> Series[Timedelta]: ... # type: ignore[overload-overlap]
823823
@overload
824824
def diff(self, periods: int = ...) -> Series[float]: ...
825825
def autocorr(self, lag: int = ...) -> float: ...
@@ -1596,7 +1596,9 @@ class Series(IndexOpsMixin[S1], NDFrame):
15961596
# just failed to generate these so I couldn't match
15971597
# them up.
15981598
@overload
1599-
def __add__(self: Series[_T_INT], other: _all_int) -> Series[_T_INT]: ...
1599+
def __add__(
1600+
self: Series[_T_INT], other: _nonseries_int | Series[int]
1601+
) -> Series[_T_INT]: ...
16001602
@overload
16011603
def __add__(
16021604
self: Series[_T_STAMP_AND_DELTA],
@@ -1622,7 +1624,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
16221624
self, other: bool | list[int] | MaskType
16231625
) -> Series[bool]: ...
16241626
@overload
1625-
def __and__(self, other: _all_int) -> Series[int]: ...
1627+
def __and__(self, other: _nonseries_int | Series[int]) -> Series[int]: ...
16261628
# def __array__(self, dtype: Optional[_bool] = ...) -> _np_ndarray
16271629
def __div__(self, other: num | _ListLike | Series[S1]) -> Series[S1]: ...
16281630
def __eq__(self, other: object) -> Series[_bool]: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride]
@@ -1650,7 +1652,9 @@ class Series(IndexOpsMixin[S1], NDFrame):
16501652
self, other: S1 | _ListLike | Series[S1] | datetime | timedelta | date
16511653
) -> Series[_bool]: ...
16521654
@overload
1653-
def __mul__(self: Series[_T_INT], other: _all_int) -> Series[_T_INT]: ...
1655+
def __mul__(
1656+
self: Series[_T_INT], other: _nonseries_int | Series[int]
1657+
) -> Series[_T_INT]: ...
16541658
@overload
16551659
def __mul__(
16561660
self: Series[_T_STAMP_AND_DELTA],
@@ -1678,7 +1682,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
16781682
self, other: bool | list[int] | MaskType
16791683
) -> Series[bool]: ...
16801684
@overload
1681-
def __or__(self, other: _all_int) -> Series[int]: ...
1685+
def __or__(self, other: _nonseries_int | Series[int]) -> Series[int]: ...
16821686
@overload
16831687
def __radd__(
16841688
self: Series[Timestamp], other: _nonseries_timedelta | Series[Timedelta]
@@ -1697,7 +1701,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
16971701
self, other: bool | MaskType | list[int]
16981702
) -> Series[bool]: ...
16991703
@overload
1700-
def __rand__(self, other: _all_int) -> Series[int]: ...
1704+
def __rand__(self, other: _nonseries_int | Series[int]) -> Series[int]: ...
17011705
def __rdiv__(self, other: num | _ListLike | Series[S1]) -> Series[S1]: ...
17021706
def __rdivmod__(self, other: num | _ListLike | Series[S1]) -> Series[S1]: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride]
17031707
@overload
@@ -1721,7 +1725,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
17211725
self, other: bool | MaskType | list[int]
17221726
) -> Series[bool]: ...
17231727
@overload
1724-
def __ror__(self, other: _all_int) -> Series[int]: ...
1728+
def __ror__(self, other: _nonseries_int | Series[int]) -> Series[int]: ...
17251729
def __rsub__(self, other: num | _ListLike | Series[S1]) -> Series: ...
17261730
@overload
17271731
def __rtruediv__(
@@ -1735,9 +1739,11 @@ class Series(IndexOpsMixin[S1], NDFrame):
17351739
self, other: bool | MaskType | list[int]
17361740
) -> Series[bool]: ...
17371741
@overload
1738-
def __rxor__(self, other: _all_int) -> Series[int]: ...
1742+
def __rxor__(self, other: _nonseries_int | Series[int]) -> Series[int]: ...
17391743
@overload
1740-
def __sub__(self: Series[_T_INT], other: _all_int) -> Series[_T_INT]: ...
1744+
def __sub__(
1745+
self: Series[_T_INT], other: _nonseries_int | Series[int]
1746+
) -> Series[_T_INT]: ...
17411747
@overload
17421748
def __sub__( # type: ignore[overload-overlap]
17431749
self: Series[Timestamp], other: _nonseries_timedelta | Series[Timedelta]
@@ -1769,7 +1775,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
17691775
self, other: bool | MaskType | list[int]
17701776
) -> Series[bool]: ...
17711777
@overload
1772-
def __xor__(self, other: _all_int) -> Series[int]: ...
1778+
def __xor__(self, other: _nonseries_int | Series[int]) -> Series[int]: ...
17731779
def __invert__(self) -> Series[bool]: ...
17741780
# properties
17751781
# @property
@@ -1831,7 +1837,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
18311837
) -> Never: ...
18321838
@overload
18331839
def cumprod(
1834-
self: Series[Timestamp] | Series[Timedelta],
1840+
self: Series[_T_STAMP_AND_DELTA],
18351841
axis: AxisIndex = ...,
18361842
skipna: _bool = ...,
18371843
*args: Any,
@@ -2163,7 +2169,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
21632169
) -> Scalar: ...
21642170
@overload
21652171
def std(
2166-
self: Series[Timestamp] | Series[Timedelta],
2172+
self: Series[_T_STAMP_AND_DELTA],
21672173
axis: AxisIndex | None = ...,
21682174
skipna: _bool | None = ...,
21692175
level: None = ...,

0 commit comments

Comments
 (0)