diff --git a/pandas-stubs/_libs/interval.pyi b/pandas-stubs/_libs/interval.pyi index 35956607..fdb0a398 100644 --- a/pandas-stubs/_libs/interval.pyi +++ b/pandas-stubs/_libs/interval.pyi @@ -201,7 +201,7 @@ class Interval(IntervalMixin, Generic[_OrderableT]): @overload def __eq__(self, other: Interval[_OrderableT]) -> bool: ... # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload] @overload - def __eq__(self: IntervalT, other: IntervalIndex[IntervalT]) -> np_ndarray_bool: ... # type: ignore[overload-overlap] + def __eq__(self: IntervalT, other: IntervalIndex[IntervalT]) -> np_ndarray_bool: ... @overload def __eq__(self, other: Series[_OrderableT]) -> Series[bool]: ... # type: ignore[overload-overlap] @overload @@ -209,7 +209,7 @@ class Interval(IntervalMixin, Generic[_OrderableT]): @overload def __ne__(self, other: Interval[_OrderableT]) -> bool: ... # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload] @overload - def __ne__(self: IntervalT, other: IntervalIndex[IntervalT]) -> np_ndarray_bool: ... # type: ignore[overload-overlap] + def __ne__(self: IntervalT, other: IntervalIndex[IntervalT]) -> np_ndarray_bool: ... @overload def __ne__(self, other: Series[_OrderableT]) -> Series[bool]: ... # type: ignore[overload-overlap] @overload diff --git a/pandas-stubs/_libs/tslibs/timedeltas.pyi b/pandas-stubs/_libs/tslibs/timedeltas.pyi index 29c602a0..b0f9bdf0 100644 --- a/pandas-stubs/_libs/tslibs/timedeltas.pyi +++ b/pandas-stubs/_libs/tslibs/timedeltas.pyi @@ -248,7 +248,7 @@ class Timedelta(timedelta): def __rmul__(self, other: Series[float]) -> TimedeltaSeries: ... # maybe related to https://github.com/python/mypy/issues/10755 @overload - def __rmul__(self, other: Index[int] | Index[float]) -> TimedeltaIndex: ... # type: ignore[misc] + def __rmul__(self, other: Index[int] | Index[float]) -> TimedeltaIndex: ... # Override due to more types supported than dt.timedelta # error: Signature of "__floordiv__" incompatible with supertype "timedelta" @overload # type: ignore[override] diff --git a/pandas-stubs/core/algorithms.pyi b/pandas-stubs/core/algorithms.pyi index 2fbcfab4..83d99b7c 100644 --- a/pandas-stubs/core/algorithms.pyi +++ b/pandas-stubs/core/algorithms.pyi @@ -24,11 +24,13 @@ from pandas._typing import ( # with extension types return the same type while standard type return ndarray @overload -def unique(values: PeriodIndex) -> PeriodIndex: ... # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload] +def unique( # pyright: ignore[reportOverlappingOverload] + values: PeriodIndex, +) -> PeriodIndex: ... @overload def unique(values: CategoricalIndex) -> CategoricalIndex: ... # type: ignore[overload-overlap] @overload -def unique(values: IntervalIndex[IntervalT]) -> IntervalIndex[IntervalT]: ... # type: ignore[overload-overlap] +def unique(values: IntervalIndex[IntervalT]) -> IntervalIndex[IntervalT]: ... @overload def unique(values: Index) -> np.ndarray: ... @overload diff --git a/pandas-stubs/core/arrays/datetimelike.pyi b/pandas-stubs/core/arrays/datetimelike.pyi index fc9548b0..cc849a10 100644 --- a/pandas-stubs/core/arrays/datetimelike.pyi +++ b/pandas-stubs/core/arrays/datetimelike.pyi @@ -67,16 +67,7 @@ class DatetimeLikeArrayMixin(ExtensionOpsMixin, ExtensionArray): def resolution(self): ... __pow__ = ... __rpow__ = ... - __mul__ = ... __rmul__ = ... - __truediv__ = ... - __rtruediv__ = ... - __floordiv__ = ... - __rfloordiv__ = ... - __mod__ = ... - __rmod__ = ... - __divmod__ = ... - __rdivmod__ = ... def __add__(self, other): ... def __radd__(self, other): ... def __sub__(self, other): ... diff --git a/pandas-stubs/core/frame.pyi b/pandas-stubs/core/frame.pyi index 62192478..80a1e8a6 100644 --- a/pandas-stubs/core/frame.pyi +++ b/pandas-stubs/core/frame.pyi @@ -190,7 +190,7 @@ class _LocIndexerFrame(_LocIndexer): ), ) -> DataFrame: ... @overload - def __getitem__( # pyright: ignore[reportOverlappingOverload] + def __getitem__( # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload] self, idx: tuple[ int | StrLike | tuple[Scalar, ...] | Callable[[DataFrame], ScalarT], @@ -307,7 +307,7 @@ class DataFrame(NDFrame, OpsMixin): na_value: Scalar = ..., ) -> np.ndarray: ... @overload - def to_dict( # type: ignore[overload-overlap] + def to_dict( self, orient: Literal["records"], *, @@ -323,7 +323,7 @@ class DataFrame(NDFrame, OpsMixin): index: Literal[True] = ..., ) -> list[dict[Hashable, Any]]: ... @overload - def to_dict( # type: ignore[overload-overlap] + def to_dict( self, orient: Literal["dict", "list", "series", "index"], *, @@ -331,7 +331,7 @@ class DataFrame(NDFrame, OpsMixin): index: Literal[True] = ..., ) -> MutableMapping[Hashable, Any]: ... @overload - def to_dict( # type: ignore[overload-overlap] + def to_dict( self, orient: Literal["split", "tight"], *, @@ -339,7 +339,7 @@ class DataFrame(NDFrame, OpsMixin): index: bool = ..., ) -> MutableMapping[Hashable, Any]: ... @overload - def to_dict( # type: ignore[overload-overlap] + def to_dict( self, orient: Literal["dict", "list", "series", "index"] = ..., *, @@ -347,7 +347,7 @@ class DataFrame(NDFrame, OpsMixin): index: Literal[True] = ..., ) -> MutableMapping[Hashable, Any]: ... @overload - def to_dict( # type: ignore[overload-overlap] + def to_dict( self, orient: Literal["split", "tight"] = ..., *, @@ -1054,7 +1054,7 @@ class DataFrame(NDFrame, OpsMixin): errors: IgnoreRaise = ..., ) -> None: ... @overload - def groupby( # type: ignore[overload-overlap] # pyright: ignore reportOverlappingOverload + def groupby( # pyright: ignore reportOverlappingOverload self, by: Scalar, axis: AxisIndex | NoDefault = ..., @@ -1078,7 +1078,7 @@ class DataFrame(NDFrame, OpsMixin): dropna: _bool = ..., ) -> DataFrameGroupBy[Scalar, Literal[False]]: ... @overload - def groupby( # type: ignore[overload-overlap] # pyright: ignore reportOverlappingOverload + def groupby( # pyright: ignore reportOverlappingOverload self, by: DatetimeIndex, axis: AxisIndex | NoDefault = ..., @@ -1090,7 +1090,7 @@ class DataFrame(NDFrame, OpsMixin): dropna: _bool = ..., ) -> DataFrameGroupBy[Timestamp, Literal[True]]: ... @overload - def groupby( # type: ignore[overload-overlap] + def groupby( self, by: DatetimeIndex, axis: AxisIndex | NoDefault = ..., @@ -1219,7 +1219,7 @@ class DataFrame(NDFrame, OpsMixin): ) -> DataFrame: ... def diff(self, periods: int = ..., axis: Axis = ...) -> DataFrame: ... @overload - def agg( # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload] + def agg( # pyright: ignore[reportOverlappingOverload] self, func: AggFuncTypeBase | AggFuncTypeDictSeries, axis: Axis = ..., **kwargs ) -> Series: ... @overload @@ -1230,7 +1230,7 @@ class DataFrame(NDFrame, OpsMixin): **kwargs, ) -> DataFrame: ... @overload - def aggregate( # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload] + def aggregate( # pyright: ignore[reportOverlappingOverload] self, func: AggFuncTypeBase | AggFuncTypeDictSeries, axis: Axis = ..., **kwargs ) -> Series: ... @overload diff --git a/pandas-stubs/core/groupby/generic.pyi b/pandas-stubs/core/groupby/generic.pyi index 8f2b5588..512599ac 100644 --- a/pandas-stubs/core/groupby/generic.pyi +++ b/pandas-stubs/core/groupby/generic.pyi @@ -189,7 +189,7 @@ _TT = TypeVar("_TT", bound=Literal[True, False]) class DataFrameGroupBy(GroupBy[DataFrame], Generic[ByT, _TT]): # error: Overload 3 for "apply" will never be used because its parameters overlap overload 1 @overload # type: ignore[override] - def apply( # type: ignore[overload-overlap] + def apply( self, func: Callable[[DataFrame], Scalar | list | dict], *args, @@ -234,12 +234,10 @@ class DataFrameGroupBy(GroupBy[DataFrame], Generic[ByT, _TT]): self, func: Callable, dropna: bool = ..., *args, **kwargs ) -> DataFrame: ... @overload - def __getitem__( # type: ignore[overload-overlap] - self, key: Scalar | Hashable | tuple[Hashable, ...] - ) -> SeriesGroupBy[Any, ByT]: ... + def __getitem__(self, key: Scalar) -> SeriesGroupBy[Any, ByT]: ... # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload] @overload - def __getitem__( # pyright: ignore[reportIncompatibleMethodOverride, reportOverlappingOverload] - self, key: Iterable[Hashable] | slice + def __getitem__( # pyright: ignore[reportIncompatibleMethodOverride] + self, key: Iterable[Hashable] ) -> DataFrameGroupBy[ByT, bool]: ... def nunique(self, dropna: bool = ...) -> DataFrame: ... def idxmax( @@ -324,7 +322,7 @@ class DataFrameGroupBy(GroupBy[DataFrame], Generic[ByT, _TT]): self, indices: TakeIndexer, axis: Axis | None | NoDefault = ..., **kwargs ) -> DataFrame: ... @overload - def skew( # type: ignore[overload-overlap] + def skew( self, axis: Axis | None | NoDefault = ..., skipna: bool = ..., diff --git a/pandas-stubs/core/groupby/groupby.pyi b/pandas-stubs/core/groupby/groupby.pyi index 66e6f825..36a60ce7 100644 --- a/pandas-stubs/core/groupby/groupby.pyi +++ b/pandas-stubs/core/groupby/groupby.pyi @@ -139,22 +139,15 @@ class BaseGroupBy(SelectionMixin[NDFrameT], GroupByIndexingMixin): @final def __iter__(self) -> Iterator[tuple[Hashable, NDFrameT]]: ... @overload - def __getitem__(self: BaseGroupBy[DataFrame], key: Scalar | Hashable | tuple[Hashable, ...]) -> generic.SeriesGroupBy: ... # type: ignore[overload-overlap] + def __getitem__(self: BaseGroupBy[DataFrame], key: Scalar) -> generic.SeriesGroupBy: ... # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload] @overload - def __getitem__( # pyright: ignore[reportOverlappingOverload] - self: BaseGroupBy[DataFrame], key: Iterable[Hashable] | slice + def __getitem__( + self: BaseGroupBy[DataFrame], key: Iterable[Hashable] ) -> generic.DataFrameGroupBy: ... @overload def __getitem__( self: BaseGroupBy[Series[S1]], - idx: ( - list[str] - | Index - | Series[S1] - | slice - | MaskType - | tuple[Hashable | slice, ...] - ), + idx: list[str] | Index | Series[S1] | MaskType | tuple[Hashable | slice, ...], ) -> generic.SeriesGroupBy: ... @overload def __getitem__(self: BaseGroupBy[Series[S1]], idx: Scalar) -> S1: ... diff --git a/pandas-stubs/core/indexes/base.pyi b/pandas-stubs/core/indexes/base.pyi index ea95aa82..406d1ad4 100644 --- a/pandas-stubs/core/indexes/base.pyi +++ b/pandas-stubs/core/indexes/base.pyi @@ -66,7 +66,7 @@ class Index(IndexOpsMixin[S1]): __hash__: ClassVar[None] # type: ignore[assignment] # overloads with additional dtypes @overload - def __new__( # type: ignore[overload-overlap] + def __new__( cls, data: Sequence[int | np.integer] | IndexOpsMixin[int] | np_ndarray_anyint, *, @@ -77,7 +77,7 @@ class Index(IndexOpsMixin[S1]): **kwargs, ) -> Index[int]: ... @overload - def __new__( # type: ignore[overload-overlap] + def __new__( cls, data: Iterable, *, @@ -88,7 +88,7 @@ class Index(IndexOpsMixin[S1]): **kwargs, ) -> Index[int]: ... @overload - def __new__( # type: ignore[overload-overlap] + def __new__( cls, data: Sequence[float | np.floating] | IndexOpsMixin[float] | np_ndarray_float, *, @@ -99,7 +99,7 @@ class Index(IndexOpsMixin[S1]): **kwargs, ) -> Index[float]: ... @overload - def __new__( # type: ignore[overload-overlap] + def __new__( cls, data: Iterable, *, @@ -110,7 +110,7 @@ class Index(IndexOpsMixin[S1]): **kwargs, ) -> Index[float]: ... @overload - def __new__( # type: ignore[overload-overlap] + def __new__( cls, data: ( Sequence[complex | np.complexfloating] @@ -125,7 +125,7 @@ class Index(IndexOpsMixin[S1]): **kwargs, ) -> Index[complex]: ... @overload - def __new__( # type: ignore[overload-overlap] + def __new__( cls, data: Iterable, *, @@ -137,7 +137,7 @@ class Index(IndexOpsMixin[S1]): ) -> Index[complex]: ... # special overloads with dedicated Index-subclasses @overload - def __new__( # type: ignore[overload-overlap] + def __new__( cls, data: Sequence[np.datetime64 | datetime] | IndexOpsMixin[datetime], *, @@ -148,7 +148,7 @@ class Index(IndexOpsMixin[S1]): **kwargs, ) -> DatetimeIndex: ... @overload - def __new__( # type: ignore[overload-overlap] + def __new__( cls, data: Iterable, *, @@ -159,7 +159,7 @@ class Index(IndexOpsMixin[S1]): **kwargs, ) -> DatetimeIndex: ... @overload - def __new__( # type: ignore[overload-overlap] + def __new__( cls, data: Sequence[Period] | IndexOpsMixin[Period], *, @@ -170,7 +170,7 @@ class Index(IndexOpsMixin[S1]): **kwargs, ) -> PeriodIndex: ... @overload - def __new__( # type: ignore[overload-overlap] + def __new__( cls, data: Iterable, *, @@ -181,7 +181,7 @@ class Index(IndexOpsMixin[S1]): **kwargs, ) -> PeriodIndex: ... @overload - def __new__( # type: ignore[overload-overlap] + def __new__( cls, data: Sequence[np.timedelta64 | timedelta] | IndexOpsMixin[timedelta], *, @@ -192,7 +192,7 @@ class Index(IndexOpsMixin[S1]): **kwargs, ) -> TimedeltaIndex: ... @overload - def __new__( # type: ignore[overload-overlap] + def __new__( cls, data: Iterable, *, @@ -203,7 +203,7 @@ class Index(IndexOpsMixin[S1]): **kwargs, ) -> TimedeltaIndex: ... @overload - def __new__( # type: ignore[overload-overlap] + def __new__( cls, data: Sequence[Interval[_OrderableT]] | IndexOpsMixin[Interval[_OrderableT]], *, @@ -214,7 +214,7 @@ class Index(IndexOpsMixin[S1]): **kwargs, ) -> IntervalIndex[Interval[_OrderableT]]: ... @overload - def __new__( # type: ignore[overload-overlap] + def __new__( cls, data: Iterable, *, @@ -422,7 +422,7 @@ class Index(IndexOpsMixin[S1]): def __gt__(self, other: Self | S1) -> np_ndarray_bool: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] # overwrite inherited methods from OpsMixin @overload - def __mul__( # type: ignore[overload-overlap] + def __mul__( self: Index[int] | Index[float], other: timedelta ) -> TimedeltaIndex: ... @overload diff --git a/pandas-stubs/core/indexes/interval.pyi b/pandas-stubs/core/indexes/interval.pyi index 5e675290..52b229a8 100644 --- a/pandas-stubs/core/indexes/interval.pyi +++ b/pandas-stubs/core/indexes/interval.pyi @@ -306,7 +306,7 @@ class IntervalIndex(ExtensionIndex[IntervalT], IntervalMixin): # misc here because int and float overlap but interval has distinct types # int gets hit first and so the correct type is returned @overload -def interval_range( # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload] +def interval_range( # pyright: ignore[reportOverlappingOverload] start: int = ..., end: int = ..., periods: int | None = ..., diff --git a/pandas-stubs/core/reshape/concat.pyi b/pandas-stubs/core/reshape/concat.pyi index b364626f..5ea794ce 100644 --- a/pandas-stubs/core/reshape/concat.pyi +++ b/pandas-stubs/core/reshape/concat.pyi @@ -25,7 +25,7 @@ from pandas._typing import ( ) @overload -def concat( +def concat( # type: ignore[overload-overlap] objs: Iterable[DataFrame] | Mapping[HashableT1, DataFrame], *, axis: Axis = ..., diff --git a/pandas-stubs/core/reshape/tile.pyi b/pandas-stubs/core/reshape/tile.pyi index 60bdde5b..336426cc 100644 --- a/pandas-stubs/core/reshape/tile.pyi +++ b/pandas-stubs/core/reshape/tile.pyi @@ -50,7 +50,7 @@ def cut( ordered: bool = ..., ) -> tuple[npt.NDArray[np.intp], IntervalIndex[IntervalT]]: ... @overload -def cut( # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload] +def cut( # pyright: ignore[reportOverlappingOverload] x: TimestampSeries, bins: ( int diff --git a/pandas-stubs/core/series.pyi b/pandas-stubs/core/series.pyi index e95d17ff..080c6a82 100644 --- a/pandas-stubs/core/series.pyi +++ b/pandas-stubs/core/series.pyi @@ -231,7 +231,7 @@ class Series(IndexOpsMixin[S1], NDFrame): __hash__: ClassVar[None] @overload - def __new__( # type: ignore[overload-overlap] + def __new__( cls, data: npt.NDArray[np.float64], index: Axes | None = ..., @@ -241,7 +241,7 @@ class Series(IndexOpsMixin[S1], NDFrame): copy: bool = ..., ) -> Series[float]: ... @overload - def __new__( # type: ignore[overload-overlap] + def __new__( cls, data: ( DatetimeIndex @@ -258,7 +258,7 @@ class Series(IndexOpsMixin[S1], NDFrame): copy: bool = ..., ) -> TimestampSeries: ... @overload - def __new__( # type: ignore[overload-overlap] + def __new__( cls, data: _ListLike, index: Axes | None = ..., @@ -268,7 +268,7 @@ class Series(IndexOpsMixin[S1], NDFrame): copy: bool = ..., ) -> TimestampSeries: ... @overload - def __new__( # type: ignore[overload-overlap] + def __new__( cls, data: PeriodIndex | Sequence[Period], index: Axes | None = ..., @@ -278,7 +278,7 @@ class Series(IndexOpsMixin[S1], NDFrame): copy: bool = ..., ) -> PeriodSeries: ... @overload - def __new__( # type: ignore[overload-overlap] + def __new__( cls, data: ( TimedeltaIndex @@ -294,7 +294,7 @@ class Series(IndexOpsMixin[S1], NDFrame): copy: bool = ..., ) -> TimedeltaSeries: ... @overload - def __new__( # type: ignore[overload-overlap] + def __new__( cls, data: ( IntervalIndex[Interval[_OrderableT]] @@ -779,7 +779,7 @@ class Series(IndexOpsMixin[S1], NDFrame): def __matmul__(self, other): ... def __rmatmul__(self, other): ... @overload - def searchsorted( # type: ignore[overload-overlap] + def searchsorted( self, value: _ListLike, side: Literal["left", "right"] = ..., @@ -926,7 +926,7 @@ class Series(IndexOpsMixin[S1], NDFrame): na_action: None = ..., ) -> Series[S2]: ... @overload - def aggregate( # type: ignore[overload-overlap] + def aggregate( self: Series[int], func: Literal["mean"], axis: AxisIndex = ..., @@ -1222,7 +1222,7 @@ class Series(IndexOpsMixin[S1], NDFrame): ignore_index: _bool = ..., ) -> Series[S1]: ... @overload - def astype( # type: ignore[overload-overlap] + def astype( self, dtype: BooleanDtypeArg, copy: _bool = ..., @@ -1512,7 +1512,7 @@ class Series(IndexOpsMixin[S1], NDFrame): ) -> Series: ... # ignore needed for mypy as we want different results based on the arguments @overload # type: ignore[override] - def __and__( # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload] + def __and__( # pyright: ignore[reportOverlappingOverload] self, other: bool | list[bool] | list[int] | np_ndarray_bool | Series[bool] ) -> Series[bool]: ... @overload @@ -1546,7 +1546,7 @@ class Series(IndexOpsMixin[S1], NDFrame): def __pow__(self, other: num | _ListLike | Series[S1]) -> Series[S1]: ... # ignore needed for mypy as we want different results based on the arguments @overload # type: ignore[override] - def __or__( # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload] + def __or__( # pyright: ignore[reportOverlappingOverload] self, other: bool | list[bool] | list[int] | np_ndarray_bool | Series[bool] ) -> Series[bool]: ... @overload @@ -1559,11 +1559,13 @@ class Series(IndexOpsMixin[S1], NDFrame): def __radd__(self, other: num | _str | _ListLike | Series) -> Series: ... # ignore needed for mypy as we want different results based on the arguments @overload # type: ignore[override] - def __rand__( # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload] + def __rand__( # pyright: ignore[reportOverlappingOverload] self, other: bool | list[bool] | list[int] | np_ndarray_bool | Series[bool] ) -> Series[bool]: ... @overload - def __rand__(self, other: int | np_ndarray_anyint | Series[int]) -> Series[int]: ... # type: ignore[misc] # pyright: ignore[reportIncompatibleMethodOverride] + def __rand__( # pyright: ignore[reportIncompatibleMethodOverride] + self, other: int | np_ndarray_anyint | Series[int] + ) -> Series[int]: ... def __rdiv__(self, other: num | _ListLike | Series[S1]) -> Series[S1]: ... def __rdivmod__(self, other: num | _ListLike | Series[S1]) -> Series[S1]: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] def __rfloordiv__(self, other: num | _ListLike | Series[S1]) -> Series[S1]: ... @@ -1578,20 +1580,24 @@ class Series(IndexOpsMixin[S1], NDFrame): def __rpow__(self, other: num | _ListLike | Series[S1]) -> Series[S1]: ... # ignore needed for mypy as we want different results based on the arguments @overload # type: ignore[override] - def __ror__( # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload] + def __ror__( # pyright: ignore[reportOverlappingOverload] self, other: bool | list[bool] | list[int] | np_ndarray_bool | Series[bool] ) -> Series[bool]: ... @overload - def __ror__(self, other: int | np_ndarray_anyint | Series[int]) -> Series[int]: ... # type: ignore[misc] # pyright: ignore[reportIncompatibleMethodOverride] + def __ror__( # pyright: ignore[reportIncompatibleMethodOverride] + self, other: int | np_ndarray_anyint | Series[int] + ) -> Series[int]: ... def __rsub__(self, other: num | _ListLike | Series[S1]) -> Series: ... def __rtruediv__(self, other: num | _ListLike | Series[S1]) -> Series: ... # ignore needed for mypy as we want different results based on the arguments @overload # type: ignore[override] - def __rxor__( # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload] + def __rxor__( # pyright: ignore[reportOverlappingOverload] self, other: bool | list[bool] | list[int] | np_ndarray_bool | Series[bool] ) -> Series[bool]: ... @overload - def __rxor__(self, other: int | np_ndarray_anyint | Series[int]) -> Series[int]: ... # type: ignore[misc] # pyright: ignore[reportIncompatibleMethodOverride] + def __rxor__( # pyright: ignore[reportIncompatibleMethodOverride] + self, other: int | np_ndarray_anyint | Series[int] + ) -> Series[int]: ... @overload def __sub__( self: Series[Timestamp], @@ -1611,7 +1617,7 @@ class Series(IndexOpsMixin[S1], NDFrame): def __truediv__(self, other: num | _ListLike | Series[S1]) -> Series: ... # ignore needed for mypy as we want different results based on the arguments @overload # type: ignore[override] - def __xor__( # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload] + def __xor__( # pyright: ignore[reportOverlappingOverload] self, other: bool | list[bool] | list[int] | np_ndarray_bool | Series[bool] ) -> Series[bool]: ... @overload @@ -1995,7 +2001,7 @@ class Series(IndexOpsMixin[S1], NDFrame): # ignore needed because of mypy, for overlapping overloads # between `Series[bool]` and `Series[int]`. @overload - def sum( # type: ignore[overload-overlap] + def sum( self: Series[bool], axis: AxisIndex | None = ..., skipna: _bool | None = ..., diff --git a/pandas-stubs/io/excel/_base.pyi b/pandas-stubs/io/excel/_base.pyi index 5937fa5f..21085daf 100644 --- a/pandas-stubs/io/excel/_base.pyi +++ b/pandas-stubs/io/excel/_base.pyi @@ -120,7 +120,7 @@ def read_excel( ) -> dict[str, DataFrame]: ... @overload # mypy says this won't be matched -def read_excel( # type: ignore[misc] +def read_excel( # type: ignore[overload-cannot-match] io: ( FilePath | ReadBuffer[bytes] diff --git a/pyproject.toml b/pyproject.toml index b100cbf8..3f0a8ae5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,7 +33,7 @@ types-pytz = ">= 2022.1.1" numpy = ">= 1.23.5" [tool.poetry.group.dev.dependencies] -mypy = "1.10.1" +mypy = "1.13.0" pandas = "2.2.3" pyarrow = ">=10.0.1" pytest = ">=7.1.2" diff --git a/tests/test_frame.py b/tests/test_frame.py index c75ecd12..7a167f53 100644 --- a/tests/test_frame.py +++ b/tests/test_frame.py @@ -1776,18 +1776,18 @@ def qux( argument_3="hi", # pyright: ignore[reportCallIssue] keyword_only=(1, 2), ) - df.pipe( # type: ignore[misc] # pyright: ignore[reportCallIssue] + df.pipe( # type: ignore[call-overload] # pyright: ignore[reportCallIssue] qux, 1, [1.0, 2.0], - 11, # type: ignore[arg-type] + 11, (1, 2), # pyright: ignore[reportCallIssue] ) - df.pipe( # type: ignore[call-arg] # pyright: ignore[reportCallIssue] + df.pipe( # type: ignore[call-overload] # pyright: ignore[reportCallIssue] qux, positional_only=1, # pyright: ignore[reportCallIssue] argument_1=[1.0, 2.0], - argument_2=11, # type: ignore[arg-type] + argument_2=11, keyword_only=(1, 2), ) @@ -1962,7 +1962,7 @@ def test_types_regressions() -> None: tslist: list[pd.Timestamp] = list(pd.to_datetime(["2022-01-01", "2022-01-02"])) sseries: pd.Series = pd.Series(tslist) with pytest_warns_bounded(FutureWarning, "'d' is deprecated", lower="2.2.99"): - sseries + pd.Timedelta(1, "d") + foo = sseries + pd.Timedelta(1, "d") sseries_plus1: pd.Series = sseries + pd.Timedelta(1, "D") diff --git a/tests/test_groupby.py b/tests/test_groupby.py index fd0dae4b..69b58b7a 100644 --- a/tests/test_groupby.py +++ b/tests/test_groupby.py @@ -1052,3 +1052,9 @@ def test_engine() -> None: other_kwarg="", ) GB_DF.aggregate("size", engine="cython", engine_kwargs={}) + + +def test_groupby_getitem() -> None: + df = DataFrame(np.random.random((3, 4)), columns=["a", "b", "c", "d"]) + check(assert_type(df.groupby("a")["b"].sum(), Series), Series, float) + check(assert_type(df.groupby("a")[["b", "c"]].sum(), DataFrame), DataFrame) diff --git a/tests/test_io.py b/tests/test_io.py index 8f89b0ba..66573ff8 100644 --- a/tests/test_io.py +++ b/tests/test_io.py @@ -896,7 +896,7 @@ def test_read_excel() -> None: pd.DataFrame, ), pd.DataFrame, - ), + ) check( assert_type(pd.read_excel(path, names=range(1), header=0), pd.DataFrame), pd.DataFrame, diff --git a/tests/test_resampler.py b/tests/test_resampler.py index 70e36f05..1bef9af3 100644 --- a/tests/test_resampler.py +++ b/tests/test_resampler.py @@ -234,18 +234,18 @@ def j( arg3="hi", # pyright: ignore[reportCallIssue] kw=(1,), ) - DF.resample("ME").pipe( # type: ignore[misc] + DF.resample("ME").pipe( # type: ignore[call-overload] j, 1, [1.0], - 11, # type: ignore[arg-type] + 11, (1,), # pyright: ignore[reportCallIssue] ) - DF.resample("ME").pipe( # type: ignore[call-arg] + DF.resample("ME").pipe( # type: ignore[call-overload] j, pos=1, # pyright: ignore[reportCallIssue] arg1=[1.0], - arg2=11, # type: ignore[arg-type] + arg2=11, kw=(1,), ) diff --git a/tests/test_scalars.py b/tests/test_scalars.py index 0f8bcb1c..6beaf81d 100644 --- a/tests/test_scalars.py +++ b/tests/test_scalars.py @@ -2015,5 +2015,5 @@ def test_period_methods() -> None: def test_nattype_hashable() -> None: # GH 827 - {pd.NaT} + aset = {pd.NaT} check(assert_type(pd.NaT.__hash__(), int), int) diff --git a/tests/test_series.py b/tests/test_series.py index 210e4bc5..8a7300be 100644 --- a/tests/test_series.py +++ b/tests/test_series.py @@ -3109,18 +3109,18 @@ def first_arg_series( argument_3="hi", # pyright: ignore[reportCallIssue] keyword_only=(1, 2), ) - ser.pipe( # type: ignore[misc] + ser.pipe( # type: ignore[call-overload] first_arg_series, 1, [1.0, 2.0], - 11, # type: ignore[arg-type] + 11, (1, 2), # pyright: ignore[reportCallIssue] ) - ser.pipe( # type: ignore[call-arg] + ser.pipe( # type: ignore[call-overload] first_arg_series, positional_only=1, # pyright: ignore[reportCallIssue] argument_1=[1.0, 2.0], - argument_2=11, # type: ignore[arg-type] + argument_2=11, keyword_only=(1, 2), )