Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions pandas-stubs/_typing.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1025,9 +1025,6 @@ S1 = TypeVar("S1", bound=SeriesDType, default=Any)
# Like S0 and S1, but without `default=Any`.
S2 = TypeVar("S2", bound=SeriesDType)
S2_contra = TypeVar("S2_contra", bound=SeriesDType, contravariant=True)
S2_NDT_contra = TypeVar(
"S2_NDT_contra", bound=SeriesDTypeNoDateTime, contravariant=True
)
S2_NSDT = TypeVar("S2_NSDT", bound=SeriesDTypeNoStrDateTime)
S3 = TypeVar("S3", bound=SeriesDType)

Expand Down
44 changes: 32 additions & 12 deletions pandas-stubs/core/base.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ from pandas._typing import (
SupportsDType,
np_1darray,
np_1darray_intp,
np_ndarray,
np_ndarray_anyint,
np_ndarray_bool,
np_ndarray_complex,
np_ndarray_float,
np_ndarray_td,
Expand Down Expand Up @@ -236,16 +234,6 @@ ScalarArrayIndexSeriesTimedelta: TypeAlias = (
ScalarArrayIndexTimedelta | Series[Timedelta]
)

NumListLike: TypeAlias = ( # TODO: pandas-dev/pandas-stubs#1474 deprecated, do not use
ExtensionArray
| np_ndarray_bool
| np_ndarray_anyint
| np_ndarray_float
| np_ndarray_complex
| dict[str, np_ndarray]
| Sequence[complex]
)

@type_check_only
class ElementOpsMixin(Generic[S2]):
@overload
Expand Down Expand Up @@ -285,6 +273,30 @@ class ElementOpsMixin(Generic[S2]):
@overload
def _proto_radd(self: ElementOpsMixin[str], other: str) -> ElementOpsMixin[str]: ...
@overload
def _proto_sub(
self: ElementOpsMixin[int], other: int | np.integer
) -> ElementOpsMixin[int]: ...
@overload
def _proto_sub(
self: ElementOpsMixin[float], other: float | np.floating
) -> ElementOpsMixin[float]: ...
@overload
def _proto_sub(
self: ElementOpsMixin[complex], other: complex | np.complexfloating
) -> ElementOpsMixin[complex]: ...
@overload
def _proto_rsub(
self: ElementOpsMixin[int], other: int | np.integer
) -> ElementOpsMixin[int]: ...
@overload
def _proto_rsub(
self: ElementOpsMixin[float], other: float | np.floating
) -> ElementOpsMixin[float]: ...
@overload
def _proto_rsub(
self: ElementOpsMixin[complex], other: complex | np.complexfloating
) -> ElementOpsMixin[complex]: ...
@overload
def _proto_mul(
self: ElementOpsMixin[bool], other: bool | np.bool_
) -> ElementOpsMixin[bool]: ...
Expand Down Expand Up @@ -399,6 +411,14 @@ class Supports_ProtoAdd(Protocol[T_contra, S2]):
class Supports_ProtoRAdd(Protocol[T_contra, S2]):
def _proto_radd(self, other: T_contra, /) -> ElementOpsMixin[S2]: ...

@type_check_only
class Supports_ProtoSub(Protocol[T_contra, S2]):
def _proto_sub(self, other: T_contra, /) -> ElementOpsMixin[S2]: ...

@type_check_only
class Supports_ProtoRSub(Protocol[T_contra, S2]):
def _proto_rsub(self, other: T_contra, /) -> ElementOpsMixin[S2]: ...

@type_check_only
class Supports_ProtoMul(Protocol[T_contra, S2]):
def _proto_mul(self, other: T_contra, /) -> ElementOpsMixin[S2]: ...
Expand Down
Loading
Loading