Skip to content

Add MaskType to other cases #1073

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 17, 2024
Merged
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
11 changes: 2 additions & 9 deletions pandas-stubs/core/indexes/base.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ from pandas._typing import (
HashableT,
Label,
Level,
MaskType,
NaPosition,
TimedeltaDtypeArg,
TimestampDtypeArg,
Expand Down Expand Up @@ -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: ...
Expand Down
4 changes: 2 additions & 2 deletions pandas-stubs/core/indexes/interval.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand All @@ -31,6 +30,7 @@ from pandas._typing import (
IntervalClosedType,
IntervalT,
Label,
MaskType,
np_ndarray_anyint,
np_ndarray_bool,
npt,
Expand Down Expand Up @@ -254,7 +254,7 @@ class IntervalIndex(ExtensionIndex[IntervalT], IntervalMixin):
| np_ndarray_anyint
| Sequence[int]
| Index
| Series[bool]
| MaskType
| np_ndarray_bool
),
) -> IntervalIndex[IntervalT]: ...
Expand Down
11 changes: 2 additions & 9 deletions pandas-stubs/core/indexes/multi.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ from pandas._typing import (
Dtype,
DtypeArg,
HashableT,
MaskType,
np_ndarray_anyint,
np_ndarray_bool,
)
Expand Down Expand Up @@ -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]
Expand Down
13 changes: 2 additions & 11 deletions pandas-stubs/core/indexes/range.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)

Expand Down Expand Up @@ -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]
Expand Down
13 changes: 6 additions & 7 deletions pandas-stubs/core/series.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ from pandas._typing import (
VoidDtypeArg,
WriteBuffer,
np_ndarray_anyint,
np_ndarray_bool,
npt,
num,
)
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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]
Expand All @@ -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]
Expand All @@ -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]
Expand All @@ -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]
Expand All @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading