Skip to content

GH1184 Clean up new warnings with new version of pyright (1.1.399) #1185

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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/core/indexes/datetimelike.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class DatetimeIndexOpsMixin(ExtensionIndex[S1]):
def argmax(
self, axis: AxisIndex | None = ..., skipna: bool = ..., *args, **kwargs
) -> np.int64: ...
def __rsub__( # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride]
def __rsub__( # type: ignore[override]
self, other: DatetimeIndexOpsMixin
) -> TimedeltaIndex: ...

Expand Down
16 changes: 12 additions & 4 deletions pandas-stubs/core/indexes/interval.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -267,25 +267,33 @@ class IntervalIndex(ExtensionIndex[IntervalT], IntervalMixin):
self, other: IntervalT | IntervalIndex[IntervalT]
) -> np_ndarray_bool: ...
@overload
def __gt__(self, other: pd.Series[IntervalT]) -> pd.Series[bool]: ...
def __gt__( # pyright: ignore[reportIncompatibleMethodOverride]
self, other: pd.Series[IntervalT]
) -> pd.Series[bool]: ...
@overload # type: ignore[override]
def __ge__(
self, other: IntervalT | IntervalIndex[IntervalT]
) -> np_ndarray_bool: ...
@overload
def __ge__(self, other: pd.Series[IntervalT]) -> pd.Series[bool]: ...
def __ge__( # pyright: ignore[reportIncompatibleMethodOverride]
self, other: pd.Series[IntervalT]
) -> pd.Series[bool]: ...
@overload # type: ignore[override]
def __le__(
self, other: IntervalT | IntervalIndex[IntervalT]
) -> np_ndarray_bool: ...
@overload
def __le__(self, other: pd.Series[IntervalT]) -> pd.Series[bool]: ...
def __le__( # pyright: ignore[reportIncompatibleMethodOverride]
self, other: pd.Series[IntervalT]
) -> pd.Series[bool]: ...
@overload # type: ignore[override]
def __lt__(
self, other: IntervalT | IntervalIndex[IntervalT]
) -> np_ndarray_bool: ...
@overload
def __lt__(self, other: pd.Series[IntervalT]) -> pd.Series[bool]: ...
def __lt__( # pyright: ignore[reportIncompatibleMethodOverride]
self, other: pd.Series[IntervalT]
) -> pd.Series[bool]: ...
@overload # type: ignore[override]
def __eq__(self, other: IntervalT | IntervalIndex[IntervalT]) -> np_ndarray_bool: ... # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
@overload
Expand Down
4 changes: 3 additions & 1 deletion pandas-stubs/core/indexes/multi.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,9 @@ class MultiIndex(Index[Any]):
def equals(self, other) -> bool: ...
def equal_levels(self, other): ...
def union(self, other, sort=...): ...
def intersection(self, other: list | Self, sort: bool = ...): ...
def intersection( # pyright: ignore[reportIncompatibleMethodOverride]
self, other: list | Self, sort: bool = ...
): ...
def difference(self, other, sort=...): ...
def astype(self, dtype: DtypeArg, copy: bool = ...) -> Self: ...
def insert(self, loc, item): ...
Expand Down
2 changes: 1 addition & 1 deletion pandas-stubs/core/indexes/timedeltas.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class TimedeltaIndex(DatetimeTimedeltaMixin[Timedelta], TimedeltaIndexProperties
def __add__(self, other: DatetimeIndex) -> DatetimeIndex: ...
@overload
def __add__(self, other: dt.timedelta | Timedelta | Self) -> Self: ...
def __radd__(self, other: dt.datetime | Timestamp | DatetimeIndex) -> DatetimeIndex: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride]
def __radd__(self, other: dt.datetime | Timestamp | DatetimeIndex) -> DatetimeIndex: ... # type: ignore[override]
def __sub__(self, other: dt.timedelta | Timedelta | Self) -> Self: ...
def __mul__(self, other: num) -> Self: ...
@overload # type: ignore[override]
Expand Down
32 changes: 10 additions & 22 deletions pandas-stubs/core/series.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1602,23 +1602,21 @@ class Series(IndexOpsMixin[S1], NDFrame):
self, other: bool | list[int] | MaskType
) -> Series[bool]: ...
@overload
def __and__( # pyright: ignore[reportIncompatibleMethodOverride]
self, other: int | np_ndarray_anyint | Series[int]
) -> Series[int]: ...
def __and__(self, other: int | np_ndarray_anyint | Series[int]) -> Series[int]: ...
# def __array__(self, dtype: Optional[_bool] = ...) -> _np_ndarray
def __div__(self, other: num | _ListLike | Series[S1]) -> Series[S1]: ...
def __eq__(self, other: object) -> Series[_bool]: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride]
def __floordiv__(self, other: num | _ListLike | Series[S1]) -> Series[int]: ...
def __ge__( # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride]
def __ge__( # type: ignore[override]
self, other: S1 | _ListLike | Series[S1] | datetime | timedelta | date
) -> Series[_bool]: ...
def __gt__( # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride]
def __gt__( # type: ignore[override]
self, other: S1 | _ListLike | Series[S1] | datetime | timedelta | date
) -> Series[_bool]: ...
def __le__( # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride]
def __le__( # type: ignore[override]
self, other: S1 | _ListLike | Series[S1] | datetime | timedelta | date
) -> Series[_bool]: ...
def __lt__( # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride]
def __lt__( # type: ignore[override]
self, other: S1 | _ListLike | Series[S1] | datetime | timedelta | date
) -> Series[_bool]: ...
@overload
Expand All @@ -1636,9 +1634,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
self, other: bool | list[int] | MaskType
) -> Series[bool]: ...
@overload
def __or__( # pyright: ignore[reportIncompatibleMethodOverride]
self, other: int | np_ndarray_anyint | Series[int]
) -> Series[int]: ...
def __or__(self, other: int | np_ndarray_anyint | Series[int]) -> Series[int]: ...
@overload
def __radd__(self, other: S1 | Series[S1]) -> Self: ...
@overload
Expand All @@ -1651,9 +1647,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
self, other: bool | MaskType | list[int]
) -> Series[bool]: ...
@overload
def __rand__( # pyright: ignore[reportIncompatibleMethodOverride]
self, other: int | np_ndarray_anyint | Series[int]
) -> Series[int]: ...
def __rand__(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]: ...
Expand All @@ -1672,9 +1666,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
self, other: bool | MaskType | list[int]
) -> Series[bool]: ...
@overload
def __ror__( # pyright: ignore[reportIncompatibleMethodOverride]
self, other: int | np_ndarray_anyint | Series[int]
) -> Series[int]: ...
def __ror__(self, other: int | np_ndarray_anyint | Series[int]) -> Series[int]: ...
def __rsub__(self, other: num | _ListLike | Series[S1]) -> UnknownSeries: ...
def __rtruediv__(
self, other: num | _ListLike | Series[S1] | Path
Expand All @@ -1685,9 +1677,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
self, other: bool | MaskType | list[int]
) -> Series[bool]: ...
@overload
def __rxor__( # pyright: ignore[reportIncompatibleMethodOverride]
self, other: int | np_ndarray_anyint | Series[int]
) -> Series[int]: ...
def __rxor__(self, other: int | np_ndarray_anyint | Series[int]) -> Series[int]: ...
@overload
def __sub__(
self: Series[Timestamp],
Expand All @@ -1713,9 +1703,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
self, other: bool | MaskType | list[int]
) -> Series[bool]: ...
@overload
def __xor__( # pyright: ignore[reportIncompatibleMethodOverride]
self, other: int | np_ndarray_anyint | Series[int]
) -> Series[int]: ...
def __xor__(self, other: int | np_ndarray_anyint | Series[int]) -> Series[int]: ...
def __invert__(self) -> Series[bool]: ...
# properties
# @property
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ mypy = "1.15.0"
pandas = "2.2.3"
pyarrow = ">=10.0.1"
pytest = ">=7.1.2"
pyright = ">=1.1.396,!=1.1.398"
pyright = ">=1.1.399"
poethepoet = ">=0.16.5"
loguru = ">=0.6.0"
typing-extensions = ">=4.4.0"
Expand Down Expand Up @@ -219,6 +219,7 @@ reportUnknownParameterType = false
reportUnknownVariableType = false
reportUnusedVariable = false
reportPrivateUsage = false
reportPrivateImportUsage = false
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this becomes a problem, because reportPrivateImportUsage = true is on when people use pyright and pandas-stubs is installed.

See microsoft/pyright#10248 for a discussion. It looks like the pyright maintainer is going to consider reverting the change that created this issue, so if he does that, we can handle this PR later.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay that is very insightful!
Let's hold on this PR before pyright clarifies the situation, for now the other PRs I have made have locked pyright version.

# enable optional checks
reportMissingModuleSource = true
useLibraryCodeForTypes = false
Expand Down