Skip to content
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

Fix compatibility with latest pyright #847

Merged
merged 2 commits into from
Jan 2, 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
2 changes: 1 addition & 1 deletion pandas-stubs/_typing.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ class SequenceNotStr(Protocol[_T_co]):
def __contains__(self, value: object, /) -> bool: ...
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[_T_co]: ...
def index(self, value: Any, /, start: int = 0, stop: int = ...) -> int: ...
def index(self, value: Any, start: int = ..., stop: int = ..., /) -> int: ...
def count(self, value: Any, /) -> int: ...
def __reversed__(self) -> Iterator[_T_co]: ...

Expand Down
4 changes: 2 additions & 2 deletions pandas-stubs/core/frame.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ class _LocIndexerFrame(_LocIndexer):
],
) -> DataFrame: ...
@overload
def __getitem__(
def __getitem__( # pyright: ignore[reportOverlappingOverload]
self,
idx: tuple[
int | StrLike | tuple[Scalar, ...] | Callable[[DataFrame], ScalarT],
Expand Down Expand Up @@ -556,7 +556,7 @@ class DataFrame(NDFrame, OpsMixin):
def T(self) -> DataFrame: ...
def __getattr__(self, name: str) -> Series: ...
@overload
def __getitem__(self, key: Scalar | tuple[Hashable, ...]) -> Series: ... # type: ignore[overload-overlap]
def __getitem__(self, key: Scalar | tuple[Hashable, ...]) -> Series: ... # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
@overload
def __getitem__(self, key: Iterable[Hashable] | slice) -> DataFrame: ...
@overload
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 @@ -79,7 +79,7 @@ class IntervalIndex(ExtensionIndex[IntervalT], IntervalMixin):
) -> IntervalIndex[IntervalT]: ...
@overload
@classmethod
def from_breaks(
def from_breaks( # pyright: ignore[reportOverlappingOverload]
cls,
breaks: _EdgesInt,
closed: IntervalClosedType = ...,
Expand Down Expand Up @@ -119,7 +119,7 @@ class IntervalIndex(ExtensionIndex[IntervalT], IntervalMixin):
) -> IntervalIndex[Interval[pd.Timedelta]]: ...
@overload
@classmethod
def from_arrays(
def from_arrays( # pyright: ignore[reportOverlappingOverload]
cls,
left: _EdgesInt,
right: _EdgesInt,
Expand Down
2 changes: 1 addition & 1 deletion pandas-stubs/core/reshape/tile.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def cut(
ordered: bool = ...,
) -> tuple[npt.NDArray[np.intp], IntervalIndex[IntervalT]]: ...
@overload
def cut( # type: ignore[overload-overlap]
def cut( # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
x: TimestampSeries,
bins: int
| TimestampSeries
Expand Down
14 changes: 7 additions & 7 deletions pandas-stubs/core/series.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ 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]
def __getitem__( # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
self,
idx: Scalar | tuple[Scalar, ...],
# tuple case is for getting a specific element when using a MultiIndex
Expand Down Expand Up @@ -1465,7 +1465,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]
def __and__( # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
self, other: bool | list[bool] | list[int] | np_ndarray_bool | Series[bool]
) -> Series[bool]: ...
@overload
Expand Down Expand Up @@ -1499,7 +1499,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]
def __or__( # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
self, other: bool | list[bool] | list[int] | np_ndarray_bool | Series[bool]
) -> Series[bool]: ...
@overload
Expand All @@ -1512,7 +1512,7 @@ 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]
def __rand__( # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
self, other: bool | list[bool] | list[int] | np_ndarray_bool | Series[bool]
) -> Series[bool]: ...
@overload
Expand All @@ -1526,7 +1526,7 @@ 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]
def __ror__( # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
self, other: bool | list[bool] | list[int] | np_ndarray_bool | Series[bool]
) -> Series[bool]: ...
@overload
Expand All @@ -1535,7 +1535,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
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]
def __rxor__( # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
self, other: bool | list[bool] | list[int] | np_ndarray_bool | Series[bool]
) -> Series[bool]: ...
@overload
Expand All @@ -1559,7 +1559,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]
def __xor__( # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
self, other: bool | list[bool] | list[int] | np_ndarray_bool | Series[bool]
) -> Series[bool]: ...
@overload
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ mypy = "1.8.0"
pandas = "2.1.4"
pyarrow = ">=10.0.1"
pytest = ">=7.1.2"
pyright = ">=1.1.343"
pyright = ">=1.1.344"
poethepoet = ">=0.16.5"
loguru = ">=0.6.0"
typing-extensions = ">=4.4.0"
Expand Down Expand Up @@ -208,4 +208,3 @@ filterwarnings = [

# Next line needed to avoid poetry complaint
[tool.setuptools_scm]