diff --git a/pandas-stubs/core/indexes/base.pyi b/pandas-stubs/core/indexes/base.pyi index f37c7df62..8f44bc5e3 100644 --- a/pandas-stubs/core/indexes/base.pyi +++ b/pandas-stubs/core/indexes/base.pyi @@ -48,6 +48,7 @@ from pandas._typing import ( HashableT, Label, Level, + MaskType, NaPosition, TimedeltaDtypeArg, TimestampDtypeArg, @@ -368,15 +369,7 @@ class Index(IndexOpsMixin[S1]): @overload def __getitem__( self, - idx: ( - slice - | np_ndarray_anyint - | Sequence[int] - | Index - | Series[bool] - | Sequence[bool] - | np_ndarray_bool - ), + idx: slice | np_ndarray_anyint | Sequence[int] | Index | MaskType, ) -> Self: ... @overload def __getitem__(self, idx: int | tuple[np_ndarray_anyint, ...]) -> S1: ... diff --git a/pandas-stubs/core/indexes/interval.pyi b/pandas-stubs/core/indexes/interval.pyi index 52b229a8a..34f7aaa7d 100644 --- a/pandas-stubs/core/indexes/interval.pyi +++ b/pandas-stubs/core/indexes/interval.pyi @@ -13,7 +13,6 @@ import pandas as pd from pandas import Index from pandas.core.indexes.extension import ExtensionIndex from pandas.core.series import ( - Series, TimedeltaSeries, TimestampSeries, ) @@ -31,6 +30,7 @@ from pandas._typing import ( IntervalClosedType, IntervalT, Label, + MaskType, np_ndarray_anyint, np_ndarray_bool, npt, @@ -254,7 +254,7 @@ class IntervalIndex(ExtensionIndex[IntervalT], IntervalMixin): | np_ndarray_anyint | Sequence[int] | Index - | Series[bool] + | MaskType | np_ndarray_bool ), ) -> IntervalIndex[IntervalT]: ... diff --git a/pandas-stubs/core/indexes/multi.pyi b/pandas-stubs/core/indexes/multi.pyi index 847ca736e..95b1ede35 100644 --- a/pandas-stubs/core/indexes/multi.pyi +++ b/pandas-stubs/core/indexes/multi.pyi @@ -18,6 +18,7 @@ from pandas._typing import ( Dtype, DtypeArg, HashableT, + MaskType, np_ndarray_anyint, np_ndarray_bool, ) @@ -114,15 +115,7 @@ class MultiIndex(Index[Any]): @overload # type: ignore[override] def __getitem__( self, - idx: ( - slice - | np_ndarray_anyint - | Sequence[int] - | Index - | pd.Series[bool] - | Sequence[bool] - | np_ndarray_bool - ), + idx: slice | np_ndarray_anyint | Sequence[int] | Index | MaskType, ) -> Self: ... @overload def __getitem__( # pyright: ignore[reportIncompatibleMethodOverride] diff --git a/pandas-stubs/core/indexes/range.pyi b/pandas-stubs/core/indexes/range.pyi index e2b3bf7fa..2ed55f3d4 100644 --- a/pandas-stubs/core/indexes/range.pyi +++ b/pandas-stubs/core/indexes/range.pyi @@ -2,13 +2,12 @@ from collections.abc import Sequence from typing import overload import numpy as np -from pandas import Series from pandas.core.indexes.base import Index from pandas._typing import ( HashableT, + MaskType, np_ndarray_anyint, - np_ndarray_bool, npt, ) @@ -73,15 +72,7 @@ class RangeIndex(Index[int]): @overload # type: ignore[override] def __getitem__( self, - idx: ( - slice - | np_ndarray_anyint - | Sequence[int] - | Index - | Series[bool] - | Sequence[bool] - | np_ndarray_bool - ), + idx: slice | np_ndarray_anyint | Sequence[int] | Index | MaskType, ) -> Index: ... @overload def __getitem__( # pyright: ignore[reportIncompatibleMethodOverride] diff --git a/pandas-stubs/core/series.pyi b/pandas-stubs/core/series.pyi index c60548e90..2907cec00 100644 --- a/pandas-stubs/core/series.pyi +++ b/pandas-stubs/core/series.pyi @@ -152,7 +152,6 @@ from pandas._typing import ( VoidDtypeArg, WriteBuffer, np_ndarray_anyint, - np_ndarray_bool, npt, num, ) @@ -1544,7 +1543,7 @@ class Series(IndexOpsMixin[S1], NDFrame): # ignore needed for mypy as we want different results based on the arguments @overload # type: ignore[override] def __and__( # pyright: ignore[reportOverlappingOverload] - self, other: bool | list[bool] | list[int] | np_ndarray_bool | Series[bool] + self, other: bool | list[int] | MaskType ) -> Series[bool]: ... @overload def __and__( # pyright: ignore[reportIncompatibleMethodOverride] @@ -1578,7 +1577,7 @@ class Series(IndexOpsMixin[S1], NDFrame): # ignore needed for mypy as we want different results based on the arguments @overload # type: ignore[override] def __or__( # pyright: ignore[reportOverlappingOverload] - self, other: bool | list[bool] | list[int] | np_ndarray_bool | Series[bool] + self, other: bool | list[int] | MaskType ) -> Series[bool]: ... @overload def __or__( # pyright: ignore[reportIncompatibleMethodOverride] @@ -1591,7 +1590,7 @@ class Series(IndexOpsMixin[S1], NDFrame): # ignore needed for mypy as we want different results based on the arguments @overload # type: ignore[override] def __rand__( # pyright: ignore[reportOverlappingOverload] - self, other: bool | list[bool] | list[int] | np_ndarray_bool | Series[bool] + self, other: bool | MaskType | list[int] ) -> Series[bool]: ... @overload def __rand__( # pyright: ignore[reportIncompatibleMethodOverride] @@ -1612,7 +1611,7 @@ class Series(IndexOpsMixin[S1], NDFrame): # ignore needed for mypy as we want different results based on the arguments @overload # type: ignore[override] def __ror__( # pyright: ignore[reportOverlappingOverload] - self, other: bool | list[bool] | list[int] | np_ndarray_bool | Series[bool] + self, other: bool | MaskType | list[int] ) -> Series[bool]: ... @overload def __ror__( # pyright: ignore[reportIncompatibleMethodOverride] @@ -1623,7 +1622,7 @@ class Series(IndexOpsMixin[S1], NDFrame): # ignore needed for mypy as we want different results based on the arguments @overload # type: ignore[override] def __rxor__( # pyright: ignore[reportOverlappingOverload] - self, other: bool | list[bool] | list[int] | np_ndarray_bool | Series[bool] + self, other: bool | MaskType | list[int] ) -> Series[bool]: ... @overload def __rxor__( # pyright: ignore[reportIncompatibleMethodOverride] @@ -1649,7 +1648,7 @@ class Series(IndexOpsMixin[S1], NDFrame): # ignore needed for mypy as we want different results based on the arguments @overload # type: ignore[override] def __xor__( # pyright: ignore[reportOverlappingOverload] - self, other: bool | list[bool] | list[int] | np_ndarray_bool | Series[bool] + self, other: bool | MaskType | list[int] ) -> Series[bool]: ... @overload def __xor__( # pyright: ignore[reportIncompatibleMethodOverride] diff --git a/pyproject.toml b/pyproject.toml index 11a3dd93b..ebfe65ff4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,7 +30,7 @@ packages = [{ "include" = "pandas-stubs" }] [tool.poetry.dependencies] python = ">=3.10" types-pytz = ">= 2022.1.1" -numpy = ">= 1.23.5" +numpy = ">= 1.23.5,< 2.2.0" # wait till numpy 2.2.1 to clear [tool.poetry.group.dev.dependencies] mypy = "1.13.0"