diff --git a/pandas-stubs/_libs/missing.pyi b/pandas-stubs/_libs/missing.pyi index 4b7f244b9..8e02c6ae0 100644 --- a/pandas-stubs/_libs/missing.pyi +++ b/pandas-stubs/_libs/missing.pyi @@ -117,7 +117,7 @@ class NAType: @overload def __eq__(self, other: Index, /) -> BooleanArray: ... @overload - def __eq__( # pyright: ignore[reportIncompatibleMethodOverride] + def __eq__( # pyright: ignore[reportIncompatibleMethodOverride] # ty: ignore[invalid-method-override] self, other: Scalar, / ) -> NAType: ... @overload # type: ignore[override] @@ -127,7 +127,7 @@ class NAType: @overload def __ne__(self, other: Index, /) -> BooleanArray: ... @overload - def __ne__( # pyright: ignore[reportIncompatibleMethodOverride] + def __ne__( # pyright: ignore[reportIncompatibleMethodOverride] # ty: ignore[invalid-method-override] self, other: Scalar, / ) -> NAType: ... @overload diff --git a/pandas-stubs/_libs/tslibs/timedeltas.pyi b/pandas-stubs/_libs/tslibs/timedeltas.pyi index 5d808bb09..aea145dc3 100644 --- a/pandas-stubs/_libs/tslibs/timedeltas.pyi +++ b/pandas-stubs/_libs/tslibs/timedeltas.pyi @@ -259,7 +259,7 @@ class Timedelta(timedelta): self, other: np_ndarray[ShapeT, np.integer | np.floating] ) -> np_ndarray[ShapeT, np.timedelta64]: ... @overload - def __truediv__( + def __truediv__( # ty: ignore[invalid-method-override] self, other: np_ndarray[ShapeT, np.timedelta64] ) -> np_ndarray[ShapeT, np.floating]: ... @overload diff --git a/pandas-stubs/_libs/tslibs/timestamps.pyi b/pandas-stubs/_libs/tslibs/timestamps.pyi index 5dbb28c8f..ce2a2dee8 100644 --- a/pandas-stubs/_libs/tslibs/timestamps.pyi +++ b/pandas-stubs/_libs/tslibs/timestamps.pyi @@ -180,7 +180,9 @@ class Timestamp(datetime, SupportsIndex): self, other: np_ndarray[ShapeT, np.datetime64] ) -> np_ndarray[ShapeT, np.bool]: ... @overload - def __le__(self, other: Series[Timestamp]) -> Series[bool]: ... + def __le__( # ty: ignore[invalid-method-override] + self, other: Series[Timestamp] + ) -> Series[bool]: ... @overload # type: ignore[override] def __lt__(self, other: datetime | np.datetime64 | Self) -> bool: ... @overload @@ -190,7 +192,9 @@ class Timestamp(datetime, SupportsIndex): self, other: np_ndarray[ShapeT, np.datetime64] ) -> np_ndarray[ShapeT, np.bool]: ... @overload - def __lt__(self, other: Series[Timestamp]) -> Series[bool]: ... + def __lt__( # ty: ignore[invalid-method-override] + self, other: Series[Timestamp] + ) -> Series[bool]: ... @overload # type: ignore[override] def __ge__(self, other: datetime | np.datetime64 | Self) -> bool: ... @overload @@ -200,7 +204,9 @@ class Timestamp(datetime, SupportsIndex): self, other: np_ndarray[ShapeT, np.datetime64] ) -> np_ndarray[ShapeT, np.bool]: ... @overload - def __ge__(self, other: Series[Timestamp]) -> Series[bool]: ... + def __ge__( # ty: ignore[invalid-method-override] + self, other: Series[Timestamp] + ) -> Series[bool]: ... @overload # type: ignore[override] def __gt__(self, other: datetime | np.datetime64 | Self) -> bool: ... @overload @@ -210,7 +216,9 @@ class Timestamp(datetime, SupportsIndex): self, other: np_ndarray[ShapeT, np.datetime64] ) -> np_ndarray[ShapeT, np.bool]: ... @overload - def __gt__(self, other: Series[Timestamp]) -> Series[bool]: ... + def __gt__( # ty: ignore[invalid-method-override] + self, other: Series[Timestamp] + ) -> Series[bool]: ... # error: Signature of "__add__" incompatible with supertype "date"/"datetime" @overload # type: ignore[override] def __add__( @@ -236,7 +244,7 @@ class Timestamp(datetime, SupportsIndex): @overload def __sub__(self, other: TimedeltaIndex) -> DatetimeIndex: ... @overload - def __sub__( + def __sub__( # ty: ignore[invalid-method-override] self, other: np_ndarray[ShapeT, np.timedelta64] ) -> np_ndarray[ShapeT, np.datetime64]: ... @overload diff --git a/pandas-stubs/core/arrays/categorical.pyi b/pandas-stubs/core/arrays/categorical.pyi index 3ea880995..77f2a23ae 100644 --- a/pandas-stubs/core/arrays/categorical.pyi +++ b/pandas-stubs/core/arrays/categorical.pyi @@ -111,11 +111,11 @@ class Categorical(ExtensionArray): def take( self, indexer: TakeIndexer, *, allow_fill: bool = ..., fill_value=... ) -> Categorical: ... - def __contains__(self, key) -> bool: ... + def __contains__(self, item) -> bool: ... @overload def __getitem__(self, key: ScalarIndexer) -> Any: ... @overload - def __getitem__( + def __getitem__( # ty: ignore[invalid-method-override] self, key: SequenceIndexer | PositionalIndexerTuple, ) -> Self: ... diff --git a/pandas-stubs/core/arrays/datetimelike.pyi b/pandas-stubs/core/arrays/datetimelike.pyi index f392f64f2..a699b43e2 100644 --- a/pandas-stubs/core/arrays/datetimelike.pyi +++ b/pandas-stubs/core/arrays/datetimelike.pyi @@ -73,9 +73,9 @@ class DatetimeLikeArrayMixin(ExtensionOpsMixin, ExtensionArray): @overload def __getitem__(self, key: ScalarIndexer) -> DTScalarOrNaT: ... @overload - def __getitem__( + def __getitem__( # ty: ignore[invalid-method-override] self, - key: SequenceIndexer | PositionalIndexerTuple, + item: SequenceIndexer | PositionalIndexerTuple, ) -> Self: ... def __setitem__( # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] self, key: int | Sequence[int] | Sequence[bool] | slice, value diff --git a/pandas-stubs/core/arrays/interval.pyi b/pandas-stubs/core/arrays/interval.pyi index cdad76567..169a295e7 100644 --- a/pandas-stubs/core/arrays/interval.pyi +++ b/pandas-stubs/core/arrays/interval.pyi @@ -61,9 +61,9 @@ class IntervalArray(IntervalMixin, ExtensionArray): self, dtype: NpDtype | None = None, copy: bool | None = None ) -> np_1darray: ... @overload - def __getitem__(self, key: ScalarIndexer) -> IntervalOrNA: ... + def __getitem__(self, item: ScalarIndexer) -> IntervalOrNA: ... @overload - def __getitem__(self, key: SequenceIndexer) -> Self: ... + def __getitem__(self, item: SequenceIndexer) -> Self: ... def __setitem__(self, key, value) -> None: ... def __eq__(self, other): ... def __ne__(self, other): ... diff --git a/pandas-stubs/core/arrays/sparse/array.pyi b/pandas-stubs/core/arrays/sparse/array.pyi index 780d1786e..0d6863bbb 100644 --- a/pandas-stubs/core/arrays/sparse/array.pyi +++ b/pandas-stubs/core/arrays/sparse/array.pyi @@ -63,9 +63,9 @@ class SparseArray(ExtensionArray, ExtensionOpsMixin): @overload def __getitem__(self, key: ScalarIndexer) -> Any: ... @overload - def __getitem__( + def __getitem__( # ty: ignore[invalid-method-override] self, - key: SequenceIndexer | tuple[int | ellipsis, ...], + item: SequenceIndexer | tuple[int | ellipsis, ...], ) -> Self: ... def copy(self): ... def map(self, mapper): ... diff --git a/pandas-stubs/core/frame.pyi b/pandas-stubs/core/frame.pyi index d03189dca..344121c01 100644 --- a/pandas-stubs/core/frame.pyi +++ b/pandas-stubs/core/frame.pyi @@ -182,17 +182,17 @@ _T_MUTABLE_MAPPING_co = TypeVar( class _iLocIndexerFrame(_iLocIndexer, Generic[_T]): @overload - def __getitem__(self, idx: tuple[int, int]) -> Scalar: ... + def __getitem__(self, key: tuple[int, int]) -> Scalar: ... @overload - def __getitem__(self, idx: IndexingInt) -> Series: ... + def __getitem__(self, key: IndexingInt) -> Series: ... @overload - def __getitem__(self, idx: tuple[IndexType | MaskType, int]) -> Series: ... + def __getitem__(self, key: tuple[IndexType | MaskType, int]) -> Series: ... @overload - def __getitem__(self, idx: tuple[int, IndexType | MaskType]) -> Series: ... + def __getitem__(self, key: tuple[int, IndexType | MaskType]) -> Series: ... @overload def __getitem__( self, - idx: ( + key: ( IndexType | MaskType | tuple[IndexType | MaskType, IndexType | MaskType] @@ -203,7 +203,7 @@ class _iLocIndexerFrame(_iLocIndexer, Generic[_T]): # Keep in sync with `DataFrame.__setitem__` def __setitem__( self, - idx: ( + key: ( int | IndexType | tuple[int, int] @@ -262,7 +262,7 @@ class _LocIndexerFrame(_LocIndexer, Generic[_T]): @overload def __getitem__( self, - idx: ( + key: ( IndexType | MaskType | Callable[[DataFrame], IndexType | MaskType | Sequence[Hashable]] @@ -283,7 +283,7 @@ class _LocIndexerFrame(_LocIndexer, Generic[_T]): @overload def __setitem__( self, - idx: ( + key: ( MaskType | StrLike | _IndexSliceTuple | list[ScalarT] | IndexingInt | slice ), value: ( @@ -302,7 +302,7 @@ class _LocIndexerFrame(_LocIndexer, Generic[_T]): @overload def __setitem__( self, - idx: tuple[_IndexSliceTuple, Hashable], + key: tuple[_IndexSliceTuple, Hashable], value: ( Scalar | NAType @@ -317,17 +317,17 @@ class _LocIndexerFrame(_LocIndexer, Generic[_T]): ) -> None: ... class _iAtIndexerFrame(_iAtIndexer): - def __getitem__(self, idx: tuple[int, int]) -> Scalar: ... + def __getitem__(self, key: tuple[int, int]) -> Scalar: ... def __setitem__( self, - idx: tuple[int, int], + key: tuple[int, int], value: Scalar | NAType | NaTType | None, ) -> None: ... class _AtIndexerFrame(_AtIndexer): def __getitem__( self, - idx: tuple[ + key: tuple[ int | StrLike | Timestamp @@ -338,7 +338,7 @@ class _AtIndexerFrame(_AtIndexer): ) -> Scalar: ... def __setitem__( self, - idx: ( + key: ( MaskType | StrLike | _IndexSliceTuple | list[ScalarT] | IndexingInt | slice ), value: ( diff --git a/pandas-stubs/core/groupby/generic.pyi b/pandas-stubs/core/groupby/generic.pyi index bbd764d77..ac06e7311 100644 --- a/pandas-stubs/core/groupby/generic.pyi +++ b/pandas-stubs/core/groupby/generic.pyi @@ -205,7 +205,7 @@ class SeriesGroupBy(GroupBy[Series[S2]], Generic[S2, ByT]): # Overrides that provide more precise return types over the GroupBy class @final # type: ignore[misc] # pyrefly: ignore # bad-override - def __iter__( # pyright: ignore[reportIncompatibleMethodOverride] + def __iter__( # pyright: ignore[reportIncompatibleMethodOverride] # ty: ignore[override-of-final-method] self, ) -> Iterator[tuple[ByT, Series[S2]]]: ... @@ -244,7 +244,7 @@ class DataFrameGroupBy(GroupBy[DataFrame], Generic[ByT, _TT]): **kwargs: P.kwargs, ) -> DataFrame: ... @overload - def apply( + def apply( # ty: ignore[invalid-method-override] self, func: DFCallable3[P], /, @@ -297,7 +297,7 @@ class DataFrameGroupBy(GroupBy[DataFrame], Generic[ByT, _TT]): @overload def __getitem__(self, key: Scalar) -> SeriesGroupBy[Any, ByT]: ... # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload] @overload - def __getitem__( # pyright: ignore[reportIncompatibleMethodOverride] + def __getitem__( # pyright: ignore[reportIncompatibleMethodOverride] # ty: ignore[invalid-method-override] self, key: Iterable[Hashable] ) -> DataFrameGroupBy[ByT, _TT]: ... def nunique(self, dropna: bool = True) -> DataFrame: ... @@ -449,11 +449,13 @@ class DataFrameGroupBy(GroupBy[DataFrame], Generic[ByT, _TT]): ) -> Series: ... # Series[Axes] but this is not allowed @property def dtypes(self) -> Series: ... - def __getattr__(self, name: str) -> SeriesGroupBy[Any, ByT]: ... + def __getattr__( + self, name: str + ) -> SeriesGroupBy[Any, ByT]: ... # ty: ignore[invalid-method-override] # Overrides that provide more precise return types over the GroupBy class @final # type: ignore[misc] # pyrefly: ignore # bad-override - def __iter__( # pyright: ignore[reportIncompatibleMethodOverride] + def __iter__( # pyright: ignore[reportIncompatibleMethodOverride] # ty: ignore[override-of-final-method] self, ) -> Iterator[tuple[ByT, DataFrame]]: ... @overload diff --git a/pandas-stubs/core/indexes/datetimes.pyi b/pandas-stubs/core/indexes/datetimes.pyi index 662f4fc4f..dac70fd07 100644 --- a/pandas-stubs/core/indexes/datetimes.pyi +++ b/pandas-stubs/core/indexes/datetimes.pyi @@ -73,7 +73,7 @@ class DatetimeIndex( self, other: datetime | np.datetime64 | np_ndarray_dt | Self ) -> TimedeltaIndex: ... @overload - def __sub__( # pyright: ignore[reportIncompatibleMethodOverride] + def __sub__( # pyright: ignore[reportIncompatibleMethodOverride] # ty: ignore[invalid-method-override] self, other: timedelta | np.timedelta64 | np_ndarray_td | BaseOffset ) -> Self: ... def __truediv__( # type: ignore[override] # pyrefly: ignore[bad-override] diff --git a/pandas-stubs/core/indexes/interval.pyi b/pandas-stubs/core/indexes/interval.pyi index 186a7a0a1..8470b8b78 100644 --- a/pandas-stubs/core/indexes/interval.pyi +++ b/pandas-stubs/core/indexes/interval.pyi @@ -236,7 +236,7 @@ class IntervalIndex(ExtensionIndex[IntervalT, np.object_], IntervalMixin): ), ) -> IntervalIndex[IntervalT]: ... @overload - def __getitem__( # pyright: ignore[reportIncompatibleMethodOverride] + def __getitem__( # pyright: ignore[reportIncompatibleMethodOverride] # ty: ignore[invalid-method-override] self, idx: int ) -> IntervalT: ... @overload # type: ignore[override] @@ -244,7 +244,7 @@ class IntervalIndex(ExtensionIndex[IntervalT, np.object_], IntervalMixin): self, other: IntervalT | IntervalIndex[IntervalT] ) -> np_1darray_bool: ... @overload - def __gt__( # pyright: ignore[reportIncompatibleMethodOverride] + def __gt__( # pyright: ignore[reportIncompatibleMethodOverride] # ty: ignore[invalid-method-override] self, other: pd.Series[IntervalT] ) -> pd.Series[bool]: ... @overload # type: ignore[override] @@ -252,7 +252,7 @@ class IntervalIndex(ExtensionIndex[IntervalT, np.object_], IntervalMixin): self, other: IntervalT | IntervalIndex[IntervalT] ) -> np_1darray_bool: ... @overload - def __ge__( # pyright: ignore[reportIncompatibleMethodOverride] + def __ge__( # pyright: ignore[reportIncompatibleMethodOverride] # ty: ignore[invalid-method-override] self, other: pd.Series[IntervalT] ) -> pd.Series[bool]: ... @overload # type: ignore[override] @@ -260,7 +260,7 @@ class IntervalIndex(ExtensionIndex[IntervalT, np.object_], IntervalMixin): self, other: IntervalT | IntervalIndex[IntervalT] ) -> np_1darray_bool: ... @overload - def __le__( # pyright: ignore[reportIncompatibleMethodOverride] + def __le__( # pyright: ignore[reportIncompatibleMethodOverride] # ty: ignore[invalid-method-override] self, other: pd.Series[IntervalT] ) -> pd.Series[bool]: ... @overload # type: ignore[override] @@ -268,7 +268,7 @@ class IntervalIndex(ExtensionIndex[IntervalT, np.object_], IntervalMixin): self, other: IntervalT | IntervalIndex[IntervalT] ) -> np_1darray_bool: ... @overload - def __lt__( # pyright: ignore[reportIncompatibleMethodOverride] + def __lt__( # pyright: ignore[reportIncompatibleMethodOverride] # ty: ignore[invalid-method-override] self, other: pd.Series[IntervalT] ) -> pd.Series[bool]: ... @overload # type: ignore[override] @@ -276,7 +276,7 @@ class IntervalIndex(ExtensionIndex[IntervalT, np.object_], IntervalMixin): @overload def __eq__(self, other: pd.Series[IntervalT]) -> pd.Series[bool]: ... # type: ignore[overload-overlap] @overload - def __eq__( # pyright: ignore[reportIncompatibleMethodOverride] + def __eq__( # pyright: ignore[reportIncompatibleMethodOverride] # ty: ignore[invalid-method-override] self, other: object ) -> Literal[False]: ... @overload # type: ignore[override] @@ -284,7 +284,7 @@ class IntervalIndex(ExtensionIndex[IntervalT, np.object_], IntervalMixin): @overload def __ne__(self, other: pd.Series[IntervalT]) -> pd.Series[bool]: ... # type: ignore[overload-overlap] @overload - def __ne__( # pyright: ignore[reportIncompatibleMethodOverride] + def __ne__( # pyright: ignore[reportIncompatibleMethodOverride] # ty: ignore[invalid-method-override] self, other: object ) -> Literal[True]: ... diff --git a/pandas-stubs/core/indexes/multi.pyi b/pandas-stubs/core/indexes/multi.pyi index 3b3564295..64c0c85c9 100644 --- a/pandas-stubs/core/indexes/multi.pyi +++ b/pandas-stubs/core/indexes/multi.pyi @@ -132,7 +132,7 @@ class MultiIndex(Index): idx: slice | np_ndarray_anyint | Sequence[int] | Index | MaskType, ) -> Self: ... @overload - def __getitem__( # pyright: ignore[reportIncompatibleMethodOverride] + def __getitem__( # pyright: ignore[reportIncompatibleMethodOverride] # ty: ignore[invalid-method-override] self, key: int ) -> tuple: ... def append(self, other): ... diff --git a/pandas-stubs/core/indexes/period.pyi b/pandas-stubs/core/indexes/period.pyi index 96052bab8..b70fac3e4 100644 --- a/pandas-stubs/core/indexes/period.pyi +++ b/pandas-stubs/core/indexes/period.pyi @@ -54,7 +54,7 @@ class PeriodIndex(DatetimeIndexOpsMixin[pd.Period, np.object_], PeriodIndexField @overload def __sub__(self, other: NaTType) -> NaTType: ... @overload - def __sub__( # pyright: ignore[reportIncompatibleMethodOverride] + def __sub__( # pyright: ignore[reportIncompatibleMethodOverride] # ty: ignore[invalid-method-override] self, other: TimedeltaIndex | pd.Timedelta ) -> Self: ... @overload # type: ignore[override] @@ -63,7 +63,7 @@ class PeriodIndex(DatetimeIndexOpsMixin[pd.Period, np.object_], PeriodIndexField @overload def __rsub__(self, other: Self) -> Index: ... @overload - def __rsub__( # pyright: ignore[reportIncompatibleMethodOverride] + def __rsub__( # pyright: ignore[reportIncompatibleMethodOverride] # ty: ignore[invalid-method-override] self, other: NaTType ) -> NaTType: ... def asof_locs( diff --git a/pandas-stubs/core/indexes/range.pyi b/pandas-stubs/core/indexes/range.pyi index b752fe2c5..8b3ca4b82 100644 --- a/pandas-stubs/core/indexes/range.pyi +++ b/pandas-stubs/core/indexes/range.pyi @@ -60,7 +60,7 @@ class RangeIndex(_IndexSubclassBase[int, np.int64]): def is_monotonic_decreasing(self) -> bool: ... @property def has_duplicates(self) -> bool: ... - def factorize( + def factorize( # ty: ignore[invalid-method-override] self, sort: bool = False, use_na_sentinel: bool = True ) -> tuple[np_1darray_intp, RangeIndex]: ... @property @@ -81,7 +81,7 @@ class RangeIndex(_IndexSubclassBase[int, np.int64]): idx: slice | np_ndarray_anyint | Sequence[int] | Index | MaskType, ) -> Index: ... @overload - def __getitem__( # pyright: ignore[reportIncompatibleMethodOverride] + def __getitem__( # pyright: ignore[reportIncompatibleMethodOverride] # ty: ignore[invalid-method-override] self, idx: int ) -> int: ... def where( # type: ignore[override] diff --git a/pandas-stubs/core/indexes/timedeltas.pyi b/pandas-stubs/core/indexes/timedeltas.pyi index 46d861bdf..0f80fec5c 100644 --- a/pandas-stubs/core/indexes/timedeltas.pyi +++ b/pandas-stubs/core/indexes/timedeltas.pyi @@ -74,7 +74,7 @@ class TimedeltaIndex( @overload def __add__(self, other: datetime | DatetimeIndex) -> DatetimeIndex: ... @overload - def __add__( # pyright: ignore[reportIncompatibleMethodOverride] + def __add__( # pyright: ignore[reportIncompatibleMethodOverride] # ty: ignore[invalid-method-override] self, other: timedelta | Self ) -> Self: ... @overload # type: ignore[override] @@ -83,7 +83,7 @@ class TimedeltaIndex( @overload def __radd__(self, other: datetime | DatetimeIndex) -> DatetimeIndex: ... @overload - def __radd__( # pyright: ignore[reportIncompatibleMethodOverride] + def __radd__( # pyright: ignore[reportIncompatibleMethodOverride] # ty: ignore[invalid-method-override] self, other: timedelta | Self ) -> Self: ... def __sub__( # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] @@ -95,17 +95,21 @@ class TimedeltaIndex( self, other: timedelta | np.timedelta64 | np_ndarray_td | BaseOffset | Self ) -> Self: ... @overload - def __rsub__( # pyright: ignore[reportIncompatibleMethodOverride] + def __rsub__( # pyright: ignore[reportIncompatibleMethodOverride] # ty: ignore[invalid-method-override] self, other: datetime | np.datetime64 | np_ndarray_dt | DatetimeIndex ) -> DatetimeIndex: ... @overload # type: ignore[override] def __mul__(self, other: np_ndarray_bool | np_ndarray_complex) -> Never: ... @overload - def __mul__(self, other: _NUM_FACTOR_SEQ) -> Self: ... + def __mul__( + self, other: _NUM_FACTOR_SEQ + ) -> Self: ... # ty: ignore[invalid-method-override] @overload # type: ignore[override] def __rmul__(self, other: np_ndarray_bool | np_ndarray_complex) -> Never: ... @overload - def __rmul__(self, other: _NUM_FACTOR_SEQ) -> Self: ... + def __rmul__( + self, other: _NUM_FACTOR_SEQ + ) -> Self: ... # ty: ignore[invalid-method-override] @overload # type: ignore[override] def __truediv__( # type: ignore[overload-overlap] self, other: Index[Never] @@ -117,7 +121,7 @@ class TimedeltaIndex( @overload def __truediv__(self, other: _NUM_FACTOR_SEQ) -> Self: ... @overload - def __truediv__( # pyright: ignore[reportIncompatibleMethodOverride] + def __truediv__( # pyright: ignore[reportIncompatibleMethodOverride] # ty: ignore[invalid-method-override] self, other: _DT_FACTOR_SEQ | Self ) -> Index[float]: ... @overload # type: ignore[override] @@ -125,7 +129,7 @@ class TimedeltaIndex( self, other: np_ndarray_bool | np_ndarray_complex | np_ndarray_dt ) -> Never: ... @overload - def __rtruediv__( # pyright: ignore[reportIncompatibleMethodOverride] + def __rtruediv__( # pyright: ignore[reportIncompatibleMethodOverride] # ty: ignore[invalid-method-override] self, other: _DT_FACTOR_SEQ | Self ) -> Index[float]: ... @overload # type: ignore[override] @@ -135,7 +139,7 @@ class TimedeltaIndex( @overload def __floordiv__(self, other: _NUM_FACTOR_SEQ) -> Self: ... @overload - def __floordiv__( # pyright: ignore[reportIncompatibleMethodOverride] + def __floordiv__( # pyright: ignore[reportIncompatibleMethodOverride] # ty: ignore[invalid-method-override] self, other: _DT_FACTOR_SEQ | Self ) -> Index[int]: ... @overload @@ -143,7 +147,7 @@ class TimedeltaIndex( self, other: np_ndarray_num | np_ndarray_dt ) -> Never: ... @overload - def __rfloordiv__( # pyright: ignore[reportIncompatibleMethodOverride] + def __rfloordiv__( # pyright: ignore[reportIncompatibleMethodOverride] # ty: ignore[invalid-method-override] self, other: _DT_FACTOR_SEQ | Self ) -> Index[int]: ... @property diff --git a/pandas-stubs/core/series.pyi b/pandas-stubs/core/series.pyi index a31926ced..dfa25dc93 100644 --- a/pandas-stubs/core/series.pyi +++ b/pandas-stubs/core/series.pyi @@ -275,7 +275,7 @@ class _iLocIndexerSeries(_iLocIndexer, Generic[S1]): def __getitem__(self, idx: IndexingInt) -> S1: ... @overload def __getitem__( - self, idx: Index | Series | slice | np_ndarray_anyint + self, key: Index | Series | slice | np_ndarray_anyint ) -> Series[S1]: ... # set item @@ -285,7 +285,7 @@ class _iLocIndexerSeries(_iLocIndexer, Generic[S1]): @overload def __setitem__( self, - idx: Index | slice | np_ndarray_anyint | list[int], + key: Index | slice | np_ndarray_anyint | list[int], value: S1 | IndexOpsMixin[S1] | None, ) -> None: ... @@ -294,9 +294,9 @@ class _LocIndexerSeries(_LocIndexer, Generic[S1]): # ignore needed because of mypy. Overlapping, but we want to distinguish # having a tuple of just scalars, versus tuples that include slices or Index @overload - def __getitem__( # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload] + def __getitem__( # type: ignore[overload-overlap] self, - idx: Scalar | tuple[Scalar, ...], + key: Scalar | tuple[Scalar, ...], # tuple case is for getting a specific element when using a MultiIndex ) -> S1: ... @overload @@ -332,14 +332,11 @@ class _LocIndexerSeries(_LocIndexer, Generic[S1]): @overload def __setitem__( self, - idx: MaskType | StrLike | _IndexSliceTuple | list[ScalarT], + key: MaskType | StrLike | _IndexSliceTuple | list[ScalarT], value: S1 | ArrayLike | IndexOpsMixin[S1] | None, ) -> None: ... _DataLike: TypeAlias = ArrayLike | dict[str, np_ndarray] | SequenceNotStr[S1] -_DataLikeS1: TypeAlias = ( - ArrayLike | dict[_str, np_ndarray] | Sequence[S1] | IndexOpsMixin[S1] -) class Series(IndexOpsMixin[S1], ElementOpsMixin[S1], NDFrame): # Define __index__ because mypy thinks Series follows protocol `SupportsIndex` https://github.com/pandas-dev/pandas-stubs/pull/1332#discussion_r2285648790 @@ -516,7 +513,14 @@ class Series(IndexOpsMixin[S1], ElementOpsMixin[S1], NDFrame): def __new__( cls, data: ( - S1 | _DataLikeS1[S1] | dict[HashableT1, S1] | KeysView[S1] | ValuesView[S1] + S1 + | ArrayLike + | dict[_str, np_ndarray] + | Sequence[S1] + | IndexOpsMixin[S1] + | dict[HashableT1, S1] + | KeysView[S1] + | ValuesView[S1] ), index: AxesData | None = None, dtype: Dtype | None = None, @@ -558,7 +562,7 @@ class Series(IndexOpsMixin[S1], ElementOpsMixin[S1], NDFrame): def __array_ufunc__( self, ufunc: Callable, method: _str, *inputs: Any, **kwargs: Any ) -> Any: ... - def __array__( + def __array__( # ty: ignore[invalid-method-override] self, dtype: _str | np.dtype = ..., copy: bool | None = ... ) -> np_1darray: ... @property @@ -4646,7 +4650,7 @@ class Series(IndexOpsMixin[S1], ElementOpsMixin[S1], NDFrame): copy: _bool | _NoDefaultDoNotUse = ..., ) -> Self: ... @final - def xs( # pyright: ignore[reportIncompatibleMethodOverride] # pyrefly: ignore[bad-override] + def xs( # pyright: ignore[reportIncompatibleMethodOverride] # pyrefly: ignore[bad-override] # ty: ignore[invalid-method-override] self, key: Hashable, axis: AxisIndex = 0, # type: ignore[override] diff --git a/pyproject.toml b/pyproject.toml index 8d476f581..6faae00e8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,7 +42,7 @@ pandas = "2.3.3" pyarrow = ">=10.0.1" pytest = ">=8.4.2" pyright = ">=1.1.407" -ty = "0.0.1a25" +ty = ">=0.0.1a28" pyrefly = ">=0.39.4" poethepoet = ">=0.16.5" loguru = ">=0.6.0"