Skip to content

Commit 5459aa7

Browse files
authored
feat(series): arithmetic truediv and sub (#1312)
* feat: arithmetic sub * fix(comment): #1312 (comment) * feat(comment): #1312 (comment) * fix(comment): completeness #1312 (review) * fix: pd.Series[bool] - pd.Series[bool] * fix(comment): #1312 (comment) * fix(comment): reduce Never #1312 (review) * fix: py310 and py311 * fix(ty): ignore * fix(ruff): revert changes * fix: comments * fix: comments * fix: typing * fix: reduce ignore * fix: reduce keyword argument
1 parent 0f14e32 commit 5459aa7

File tree

10 files changed

+1216
-73
lines changed

10 files changed

+1216
-73
lines changed

pandas-stubs/_typing.pyi

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ from re import Pattern
1515
import sys
1616
from typing import (
1717
Any,
18+
Generic,
1819
Literal,
1920
Protocol,
2021
SupportsIndex,
@@ -37,6 +38,7 @@ from typing_extensions import (
3738
ParamSpec,
3839
TypeAlias,
3940
TypeVar,
41+
override,
4042
)
4143

4244
from pandas._libs.interval import Interval
@@ -818,6 +820,8 @@ np_ndarray_float: TypeAlias = npt.NDArray[np.floating]
818820
np_ndarray_complex: TypeAlias = npt.NDArray[np.complexfloating]
819821
np_ndarray_bool: TypeAlias = npt.NDArray[np.bool_]
820822
np_ndarray_str: TypeAlias = npt.NDArray[np.str_]
823+
np_ndarray_dt: TypeAlias = npt.NDArray[np.datetime64]
824+
np_ndarray_td: TypeAlias = npt.NDArray[np.timedelta64]
821825

822826
# Define shape and generic type variables with defaults similar to numpy
823827
GenericT = TypeVar("GenericT", bound=np.generic, default=Any)
@@ -1055,4 +1059,14 @@ DictConvertible: TypeAlias = FulldatetimeDict | DataFrame
10551059
# where it is the only acceptable type.
10561060
Incomplete: TypeAlias = Any
10571061

1062+
# differentiating between bool and int/float/complex
1063+
# https://github.com/pandas-dev/pandas-stubs/pull/1312#pullrequestreview-3126128971
1064+
class Just(Protocol, Generic[T]):
1065+
@property # type: ignore[override]
1066+
@override
1067+
def __class__(self, /) -> type[T]: ...
1068+
@__class__.setter
1069+
@override
1070+
def __class__(self, t: type[T], /) -> None: ...
1071+
10581072
__all__ = ["npt", "type_t"]

pandas-stubs/core/groupby/groupby.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ from pandas._typing import (
7474
from pandas.plotting import PlotAccessor
7575

7676
_ResamplerGroupBy: TypeAlias = (
77-
DatetimeIndexResamplerGroupby[NDFrameT]
78-
| PeriodIndexResamplerGroupby[NDFrameT]
79-
| TimedeltaIndexResamplerGroupby[NDFrameT]
77+
DatetimeIndexResamplerGroupby[NDFrameT] # ty: ignore[invalid-argument-type]
78+
| PeriodIndexResamplerGroupby[NDFrameT] # ty: ignore[invalid-argument-type]
79+
| TimedeltaIndexResamplerGroupby[NDFrameT] # ty: ignore[invalid-argument-type]
8080
)
8181

8282
class GroupBy(BaseGroupBy[NDFrameT]):

0 commit comments

Comments
 (0)