Skip to content

Commit 78bc416

Browse files
committed
wip
1 parent 550186b commit 78bc416

File tree

8 files changed

+1341
-247
lines changed

8 files changed

+1341
-247
lines changed

pandas-stubs/core/base.pyi

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@ from pandas._typing import (
4545
SupportsDType,
4646
np_1darray,
4747
np_1darray_intp,
48-
np_ndarray,
4948
np_ndarray_anyint,
50-
np_ndarray_bool,
5149
np_ndarray_complex,
5250
np_ndarray_float,
5351
np_ndarray_td,
@@ -236,16 +234,6 @@ ScalarArrayIndexSeriesTimedelta: TypeAlias = (
236234
ScalarArrayIndexTimedelta | Series[Timedelta]
237235
)
238236

239-
NumListLike: TypeAlias = ( # TODO: pandas-dev/pandas-stubs#1474 deprecated, do not use
240-
ExtensionArray
241-
| np_ndarray_bool
242-
| np_ndarray_anyint
243-
| np_ndarray_float
244-
| np_ndarray_complex
245-
| dict[str, np_ndarray]
246-
| Sequence[complex]
247-
)
248-
249237
@type_check_only
250238
class ElementOpsMixin(Generic[S2]):
251239
@overload

pandas-stubs/core/series.pyi

Lines changed: 62 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ from pandas.core.base import (
8282
ArrayIndexTimedeltaNoSeq,
8383
ElementOpsMixin,
8484
IndexOpsMixin,
85-
NumListLike,
8685
ScalarArrayIndexSeriesComplex,
8786
ScalarArrayIndexSeriesJustComplex,
8887
ScalarArrayIndexSeriesJustFloat,
@@ -199,7 +198,6 @@ from pandas._typing import (
199198
Renamer,
200199
ReplaceValue,
201200
S2_contra,
202-
S2_NDT_contra,
203201
Scalar,
204202
ScalarT,
205203
SequenceNotStr,
@@ -1767,12 +1765,8 @@ class Series(IndexOpsMixin[S1], ElementOpsMixin[S1], NDFrame):
17671765
) -> Series[S2]: ...
17681766
@overload
17691767
def __add__(
1770-
self: Series[S2_contra], other: SupportsRAdd[S2_contra, S2]
1771-
) -> Series[S2]: ...
1772-
# pandas-dev/pandas#62353
1773-
@overload
1774-
def __add__(
1775-
self: Series[S2_NDT_contra], other: Sequence[SupportsRAdd[S2_NDT_contra, S2]]
1768+
self: Series[S2_contra],
1769+
other: SupportsRAdd[S2_contra, S2] | Sequence[SupportsRAdd[S2_contra, S2]],
17761770
) -> Series[S2]: ...
17771771
@overload
17781772
def __add__(
@@ -2006,12 +2000,8 @@ class Series(IndexOpsMixin[S1], ElementOpsMixin[S1], NDFrame):
20062000
) -> Series[S2]: ...
20072001
@overload
20082002
def __radd__(
2009-
self: Series[S2_contra], other: SupportsAdd[S2_contra, S2]
2010-
) -> Series[S2]: ...
2011-
# pandas-dev/pandas#62353
2012-
@overload
2013-
def __radd__(
2014-
self: Series[S2_NDT_contra], other: Sequence[SupportsAdd[S2_NDT_contra, S2]]
2003+
self: Series[S2_contra],
2004+
other: SupportsAdd[S2_contra, S2] | Sequence[SupportsAdd[S2_contra, S2]],
20152005
) -> Series[S2]: ...
20162006
@overload
20172007
def __radd__(
@@ -2515,7 +2505,17 @@ class Series(IndexOpsMixin[S1], ElementOpsMixin[S1], NDFrame):
25152505
) -> Series[_bool]: ...
25162506
@overload
25172507
def __mul__( # type: ignore[overload-overlap]
2518-
self: Series[Never], other: complex | NumListLike | Index | Series
2508+
self: Series[Never],
2509+
other: (
2510+
complex
2511+
| Sequence[complex]
2512+
| np_ndarray_bool
2513+
| np_ndarray_anyint
2514+
| np_ndarray_float
2515+
| np_ndarray_complex
2516+
| Index
2517+
| Series
2518+
),
25192519
) -> Series: ...
25202520
@overload
25212521
def __mul__(self, other: Index[Never] | Series[Never]) -> Series: ...
@@ -2731,7 +2731,17 @@ class Series(IndexOpsMixin[S1], ElementOpsMixin[S1], NDFrame):
27312731
) -> Series[complex]: ...
27322732
@overload
27332733
def __rmul__( # type: ignore[overload-overlap]
2734-
self: Series[Never], other: complex | NumListLike | Index | Series
2734+
self: Series[Never],
2735+
other: (
2736+
complex
2737+
| Sequence[complex]
2738+
| np_ndarray_bool
2739+
| np_ndarray_anyint
2740+
| np_ndarray_float
2741+
| np_ndarray_complex
2742+
| Index
2743+
| Series
2744+
),
27352745
) -> Series: ...
27362746
@overload
27372747
def __rmul__(self, other: Index[Never] | Series[Never]) -> Series: ... # type: ignore[misc]
@@ -2980,7 +2990,16 @@ class Series(IndexOpsMixin[S1], ElementOpsMixin[S1], NDFrame):
29802990
@overload
29812991
def __sub__(
29822992
self: Series[Never],
2983-
other: complex | NumListLike | Index[T_COMPLEX] | Series[T_COMPLEX],
2993+
other: (
2994+
complex
2995+
| Sequence[complex]
2996+
| np_ndarray_bool
2997+
| np_ndarray_anyint
2998+
| np_ndarray_float
2999+
| np_ndarray_complex
3000+
| Index[T_COMPLEX]
3001+
| Series[T_COMPLEX]
3002+
),
29843003
) -> Series: ...
29853004
@overload
29863005
def __sub__(self, other: Index[Never] | Series[Never]) -> Series: ...
@@ -3076,7 +3095,12 @@ class Series(IndexOpsMixin[S1], ElementOpsMixin[S1], NDFrame):
30763095
def __sub__(
30773096
self: Series[Timestamp],
30783097
other: (
3079-
datetime | np.datetime64 | np_ndarray_dt | DatetimeIndex | Series[Timestamp]
3098+
datetime
3099+
| np.datetime64
3100+
| Sequence[datetime]
3101+
| np_ndarray_dt
3102+
| DatetimeIndex
3103+
| Series[Timestamp]
30803104
),
30813105
) -> Series[Timedelta]: ...
30823106
@overload
@@ -3111,7 +3135,16 @@ class Series(IndexOpsMixin[S1], ElementOpsMixin[S1], NDFrame):
31113135
@overload
31123136
def sub(
31133137
self: Series[Never],
3114-
other: complex | NumListLike | Index[T_COMPLEX] | Series[T_COMPLEX],
3138+
other: (
3139+
complex
3140+
| Sequence[complex]
3141+
| np_ndarray_bool
3142+
| np_ndarray_anyint
3143+
| np_ndarray_float
3144+
| np_ndarray_complex
3145+
| Index[T_COMPLEX]
3146+
| Series[T_COMPLEX]
3147+
),
31153148
level: Level | None = None,
31163149
fill_value: float | None = None,
31173150
axis: int = 0,
@@ -3294,8 +3327,12 @@ class Series(IndexOpsMixin[S1], ElementOpsMixin[S1], NDFrame):
32943327
complex
32953328
| datetime
32963329
| np.datetime64
3330+
| Sequence[complex | datetime]
32973331
| np_ndarray_dt
3298-
| NumListLike
3332+
| np_ndarray_bool
3333+
| np_ndarray_anyint
3334+
| np_ndarray_float
3335+
| np_ndarray_complex
32993336
| Index[T_COMPLEX]
33003337
| Series[T_COMPLEX]
33013338
),
@@ -3427,10 +3464,13 @@ class Series(IndexOpsMixin[S1], ElementOpsMixin[S1], NDFrame):
34273464
other: (
34283465
complex
34293466
| datetime
3430-
| Sequence[datetime]
34313467
| np.datetime64
3468+
| Sequence[complex | datetime]
34323469
| np_ndarray_dt
3433-
| NumListLike
3470+
| np_ndarray_bool
3471+
| np_ndarray_anyint
3472+
| np_ndarray_float
3473+
| np_ndarray_complex
34343474
| Index[T_COMPLEX]
34353475
| Series[T_COMPLEX]
34363476
| Series[Timestamp]

0 commit comments

Comments
 (0)