@@ -184,10 +184,13 @@ from pandas.plotting import PlotAccessor
184
184
185
185
_scalar_timedelta : TypeAlias = timedelta | np .timedelta64 | BaseOffset | Timedelta
186
186
_vector_timedelta : TypeAlias = (
187
- Sequence [timedelta ] | Sequence [Timedelta ] | Series [ Timedelta ] | TimedeltaIndex
187
+ Sequence [timedelta ] | Sequence [Timedelta ] | TimedeltaIndex
188
188
)
189
- _all_timedelta : TypeAlias = _scalar_timedelta | _vector_timedelta
190
- _stamp_and_delta = TypeVar ("_stamp_and_delta" , bound = Timestamp | Timedelta )
189
+ _nonseries_timedelta : TypeAlias = _scalar_timedelta | _vector_timedelta
190
+ _all_int : TypeAlias = int | np_ndarray_anyint | Series [int ] | Sequence [int ]
191
+
192
+ _T_INT = TypeVar ("_T_INT" , bound = int )
193
+ _T_STAMP_AND_DELTA = TypeVar ("_T_STAMP_AND_DELTA" , bound = Timestamp | Timedelta )
191
194
192
195
class _iLocIndexerSeries (_iLocIndexer , Generic [S1 ]):
193
196
# get item
@@ -1593,14 +1596,12 @@ class Series(IndexOpsMixin[S1], NDFrame):
1593
1596
# just failed to generate these so I couldn't match
1594
1597
# them up.
1595
1598
@overload
1596
- def __add__ (
1597
- self : Series [int ],
1598
- other : int | np_ndarray_anyint | Series [int ] | Sequence [int ],
1599
- ) -> Series [int ]: ...
1599
+ def __add__ (self : Series [_T_INT ], other : _all_int ) -> Series [_T_INT ]: ...
1600
1600
@overload
1601
1601
def __add__ (
1602
- self : Series [Timestamp ], other : _all_timedelta
1603
- ) -> Series [Timestamp ]: ...
1602
+ self : Series [_T_STAMP_AND_DELTA ],
1603
+ other : _nonseries_timedelta | Series [Timedelta ],
1604
+ ) -> Series [_T_STAMP_AND_DELTA ]: ...
1604
1605
@overload
1605
1606
def __add__ (self : Series [Timedelta ], other : Period ) -> PeriodSeries : ...
1606
1607
@overload
@@ -1609,10 +1610,6 @@ class Series(IndexOpsMixin[S1], NDFrame):
1609
1610
other : datetime | Timestamp | Series [Timestamp ] | DatetimeIndex ,
1610
1611
) -> Series [Timestamp ]: ...
1611
1612
@overload
1612
- def __add__ (
1613
- self : Series [Timedelta ], other : timedelta | Timedelta | np .timedelta64
1614
- ) -> Series [Timedelta ]: ...
1615
- @overload
1616
1613
def __add__ (self , other : S1 | Self ) -> Self : ...
1617
1614
@overload
1618
1615
def __add__ (
@@ -1625,7 +1622,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
1625
1622
self , other : bool | list [int ] | MaskType
1626
1623
) -> Series [bool ]: ...
1627
1624
@overload
1628
- def __and__ (self , other : int | np_ndarray_anyint | Series [ int ] ) -> Series [int ]: ...
1625
+ def __and__ (self , other : _all_int ) -> Series [int ]: ...
1629
1626
# def __array__(self, dtype: Optional[_bool] = ...) -> _np_ndarray
1630
1627
def __div__ (self , other : num | _ListLike | Series [S1 ]) -> Series [S1 ]: ...
1631
1628
def __eq__ (self , other : object ) -> Series [_bool ]: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride]
@@ -1636,13 +1633,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
1636
1633
@overload
1637
1634
def __floordiv__ (
1638
1635
self : Series [Timedelta ],
1639
- other : (
1640
- timedelta
1641
- | Series [Timedelta ]
1642
- | np .timedelta64
1643
- | TimedeltaIndex
1644
- | Sequence [timedelta ]
1645
- ),
1636
+ other : _nonseries_timedelta | Series [Timedelta ],
1646
1637
) -> Series [int ]: ...
1647
1638
@overload
1648
1639
def __floordiv__ (self , other : num | _ListLike | Series [S1 ]) -> Series [int ]: ...
@@ -1659,21 +1650,25 @@ class Series(IndexOpsMixin[S1], NDFrame):
1659
1650
self , other : S1 | _ListLike | Series [S1 ] | datetime | timedelta | date
1660
1651
) -> Series [_bool ]: ...
1661
1652
@overload
1653
+ def __mul__ (self : Series [_T_INT ], other : _all_int ) -> Series [_T_INT ]: ...
1654
+ @overload
1662
1655
def __mul__ (
1663
- self : Series [Timestamp ],
1664
- other : float | Series [int ] | Series [float ] | Sequence [float ],
1665
- ) -> Series [Timestamp ]: ...
1656
+ self : Series [_T_STAMP_AND_DELTA ],
1657
+ other : (
1658
+ num | Sequence [num ] | Series [int ] | Series [float ] | float | Sequence [float ]
1659
+ ),
1660
+ ) -> Series [_T_STAMP_AND_DELTA ]: ...
1666
1661
@overload
1667
1662
def __mul__ (
1668
- self : Series [Timedelta ],
1669
- other : num | Sequence [ num ] | Series [int ] | Series [ float ],
1670
- ) -> Series [ Timedelta ] : ...
1663
+ self : Series [_T_STAMP_AND_DELTA ],
1664
+ other : _nonseries_timedelta | Series [Timedelta ],
1665
+ ) -> Never : ...
1671
1666
@overload
1672
1667
def __mul__ (
1673
- self , other : timedelta | Timedelta | Series [Timedelta ] | np . timedelta64
1668
+ self , other : _nonseries_timedelta | Series [Timedelta ]
1674
1669
) -> Series [Timedelta ]: ...
1675
1670
@overload
1676
- def __mul__ (self : Series [ S1 ] , other : num | _ListLike | Series ) -> Series [S1 ]: ...
1671
+ def __mul__ (self , other : num | _ListLike | Series [ S1 ] ) -> Series [S1 ]: ...
1677
1672
def __mod__ (self , other : num | _ListLike | Series [S1 ]) -> Series [S1 ]: ...
1678
1673
def __ne__ (self , other : object ) -> Series [_bool ]: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride]
1679
1674
def __pow__ (self , other : num | _ListLike | Series [S1 ]) -> Series [S1 ]: ...
@@ -1683,10 +1678,10 @@ class Series(IndexOpsMixin[S1], NDFrame):
1683
1678
self , other : bool | list [int ] | MaskType
1684
1679
) -> Series [bool ]: ...
1685
1680
@overload
1686
- def __or__ (self , other : int | np_ndarray_anyint | Series [ int ] ) -> Series [int ]: ...
1681
+ def __or__ (self , other : _all_int ) -> Series [int ]: ...
1687
1682
@overload
1688
1683
def __radd__ (
1689
- self : Series [Timestamp ], other : _all_timedelta
1684
+ self : Series [Timestamp ], other : _nonseries_timedelta | Series [ Timedelta ]
1690
1685
) -> Series [Timestamp ]: ...
1691
1686
@overload
1692
1687
def __radd__ (
@@ -1702,12 +1697,12 @@ class Series(IndexOpsMixin[S1], NDFrame):
1702
1697
self , other : bool | MaskType | list [int ]
1703
1698
) -> Series [bool ]: ...
1704
1699
@overload
1705
- def __rand__ (self , other : int | np_ndarray_anyint | Series [ int ] ) -> Series [int ]: ...
1700
+ def __rand__ (self , other : _all_int ) -> Series [int ]: ...
1706
1701
def __rdiv__ (self , other : num | _ListLike | Series [S1 ]) -> Series [S1 ]: ...
1707
1702
def __rdivmod__ (self , other : num | _ListLike | Series [S1 ]) -> Series [S1 ]: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride]
1708
1703
@overload
1709
1704
def __rfloordiv__ (
1710
- self : Series [Timedelta ], other : _all_timedelta
1705
+ self : Series [Timedelta ], other : _nonseries_timedelta | Series [ Timedelta ]
1711
1706
) -> Series [int ]: ...
1712
1707
@overload
1713
1708
def __rfloordiv__ (self , other : num | _ListLike | Series [S1 ]) -> Series [S1 ]: ...
@@ -1726,11 +1721,11 @@ class Series(IndexOpsMixin[S1], NDFrame):
1726
1721
self , other : bool | MaskType | list [int ]
1727
1722
) -> Series [bool ]: ...
1728
1723
@overload
1729
- def __ror__ (self , other : int | np_ndarray_anyint | Series [ int ] ) -> Series [int ]: ...
1724
+ def __ror__ (self , other : _all_int ) -> Series [int ]: ...
1730
1725
def __rsub__ (self , other : num | _ListLike | Series [S1 ]) -> Series : ...
1731
1726
@overload
1732
1727
def __rtruediv__ (
1733
- self : Series [Timedelta ], other : _all_timedelta
1728
+ self : Series [Timedelta ], other : _nonseries_timedelta | Series [ Timedelta ]
1734
1729
) -> Series [float ]: ...
1735
1730
@overload
1736
1731
def __rtruediv__ (self , other : num | _ListLike | Series [S1 ] | Path ) -> Series : ...
@@ -1740,22 +1735,16 @@ class Series(IndexOpsMixin[S1], NDFrame):
1740
1735
self , other : bool | MaskType | list [int ]
1741
1736
) -> Series [bool ]: ...
1742
1737
@overload
1743
- def __rxor__ (self , other : int | np_ndarray_anyint | Series [ int ] ) -> Series [int ]: ...
1738
+ def __rxor__ (self , other : _all_int ) -> Series [int ]: ...
1744
1739
@overload
1745
- def __sub__ (
1746
- self : Series [int ],
1747
- other : int | np_ndarray_anyint | Series [int ] | Sequence [int ],
1748
- ) -> Series [int ]: ...
1740
+ def __sub__ (self : Series [_T_INT ], other : _all_int ) -> Series [_T_INT ]: ...
1749
1741
@overload
1750
- def __sub__ (
1751
- self : Series [Timestamp ], other : _all_timedelta
1742
+ def __sub__ ( # type: ignore[overload-overlap]
1743
+ self : Series [Timestamp ], other : _nonseries_timedelta | Series [ Timedelta ]
1752
1744
) -> Series [Timestamp ]: ...
1753
1745
@overload
1754
1746
def __sub__ (
1755
- self : Series [Timedelta ],
1756
- other : (
1757
- timedelta | Timedelta | Series [Timedelta ] | TimedeltaIndex | np .timedelta64
1758
- ),
1747
+ self , other : _nonseries_timedelta | Series [Timedelta ]
1759
1748
) -> Series [Timedelta ]: ...
1760
1749
@overload
1761
1750
def __sub__ (
@@ -1765,26 +1754,22 @@ class Series(IndexOpsMixin[S1], NDFrame):
1765
1754
def __sub__ (self , other : num | _ListLike | Series ) -> Series : ...
1766
1755
@overload
1767
1756
def __truediv__ (
1768
- self : Series [Timestamp ],
1757
+ self : Series [_T_STAMP_AND_DELTA ],
1769
1758
other : float | Series [int ] | Series [float ] | Sequence [float ],
1770
- ) -> Series [Timestamp ]: ...
1759
+ ) -> Series [_T_STAMP_AND_DELTA ]: ...
1771
1760
@overload
1772
1761
def __truediv__ (
1773
- self : Series [Timedelta ], other : _all_timedelta
1762
+ self : Series [Timedelta ], other : _nonseries_timedelta | Series [ Timedelta ]
1774
1763
) -> Series [float ]: ...
1775
1764
@overload
1776
- def __truediv__ (
1777
- self : Series [Timedelta ], other : float | Sequence [float ]
1778
- ) -> Series [Timedelta ]: ...
1779
- @overload
1780
1765
def __truediv__ (self , other : num | _ListLike | Series [S1 ] | Path ) -> Series : ...
1781
1766
# ignore needed for mypy as we want different results based on the arguments
1782
1767
@overload # type: ignore[override]
1783
1768
def __xor__ ( # pyright: ignore[reportOverlappingOverload]
1784
1769
self , other : bool | MaskType | list [int ]
1785
1770
) -> Series [bool ]: ...
1786
1771
@overload
1787
- def __xor__ (self , other : int | np_ndarray_anyint | Series [ int ] ) -> Series [int ]: ...
1772
+ def __xor__ (self , other : _all_int ) -> Series [int ]: ...
1788
1773
def __invert__ (self ) -> Series [bool ]: ...
1789
1774
# properties
1790
1775
# @property
@@ -1965,13 +1950,13 @@ class Series(IndexOpsMixin[S1], NDFrame):
1965
1950
) -> S1 : ...
1966
1951
@overload
1967
1952
def mean (
1968
- self : Series [_stamp_and_delta ],
1953
+ self : Series [_T_STAMP_AND_DELTA ],
1969
1954
axis : AxisIndex | None = ...,
1970
1955
skipna : _bool = ...,
1971
1956
level : None = ...,
1972
1957
numeric_only : _bool = ...,
1973
1958
** kwargs : Any ,
1974
- ) -> _stamp_and_delta : ...
1959
+ ) -> _T_STAMP_AND_DELTA : ...
1975
1960
@overload
1976
1961
def mean (
1977
1962
self ,
0 commit comments