Skip to content

Commit 56eafc1

Browse files
authored
Fix compatibility with latest pyright (#847)
* Fix compatibility with latest pyright * Remove 0 default and update pyright version
1 parent 117e97a commit 56eafc1

File tree

6 files changed

+14
-15
lines changed

6 files changed

+14
-15
lines changed

pandas-stubs/_typing.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ class SequenceNotStr(Protocol[_T_co]):
437437
def __contains__(self, value: object, /) -> bool: ...
438438
def __len__(self) -> int: ...
439439
def __iter__(self) -> Iterator[_T_co]: ...
440-
def index(self, value: Any, /, start: int = 0, stop: int = ...) -> int: ...
440+
def index(self, value: Any, start: int = ..., stop: int = ..., /) -> int: ...
441441
def count(self, value: Any, /) -> int: ...
442442
def __reversed__(self) -> Iterator[_T_co]: ...
443443

pandas-stubs/core/frame.pyi

+2-2
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ class _LocIndexerFrame(_LocIndexer):
174174
],
175175
) -> DataFrame: ...
176176
@overload
177-
def __getitem__(
177+
def __getitem__( # pyright: ignore[reportOverlappingOverload]
178178
self,
179179
idx: tuple[
180180
int | StrLike | tuple[Scalar, ...] | Callable[[DataFrame], ScalarT],
@@ -556,7 +556,7 @@ class DataFrame(NDFrame, OpsMixin):
556556
def T(self) -> DataFrame: ...
557557
def __getattr__(self, name: str) -> Series: ...
558558
@overload
559-
def __getitem__(self, key: Scalar | tuple[Hashable, ...]) -> Series: ... # type: ignore[overload-overlap]
559+
def __getitem__(self, key: Scalar | tuple[Hashable, ...]) -> Series: ... # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
560560
@overload
561561
def __getitem__(self, key: Iterable[Hashable] | slice) -> DataFrame: ...
562562
@overload

pandas-stubs/core/indexes/interval.pyi

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class IntervalIndex(ExtensionIndex[IntervalT], IntervalMixin):
7979
) -> IntervalIndex[IntervalT]: ...
8080
@overload
8181
@classmethod
82-
def from_breaks(
82+
def from_breaks( # pyright: ignore[reportOverlappingOverload]
8383
cls,
8484
breaks: _EdgesInt,
8585
closed: IntervalClosedType = ...,
@@ -119,7 +119,7 @@ class IntervalIndex(ExtensionIndex[IntervalT], IntervalMixin):
119119
) -> IntervalIndex[Interval[pd.Timedelta]]: ...
120120
@overload
121121
@classmethod
122-
def from_arrays(
122+
def from_arrays( # pyright: ignore[reportOverlappingOverload]
123123
cls,
124124
left: _EdgesInt,
125125
right: _EdgesInt,

pandas-stubs/core/reshape/tile.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def cut(
5050
ordered: bool = ...,
5151
) -> tuple[npt.NDArray[np.intp], IntervalIndex[IntervalT]]: ...
5252
@overload
53-
def cut( # type: ignore[overload-overlap]
53+
def cut( # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
5454
x: TimestampSeries,
5555
bins: int
5656
| TimestampSeries

pandas-stubs/core/series.pyi

+7-7
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ class _LocIndexerSeries(_LocIndexer, Generic[S1]):
179179
# ignore needed because of mypy. Overlapping, but we want to distinguish
180180
# having a tuple of just scalars, versus tuples that include slices or Index
181181
@overload
182-
def __getitem__( # type: ignore[overload-overlap]
182+
def __getitem__( # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
183183
self,
184184
idx: Scalar | tuple[Scalar, ...],
185185
# tuple case is for getting a specific element when using a MultiIndex
@@ -1465,7 +1465,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
14651465
) -> Series: ...
14661466
# ignore needed for mypy as we want different results based on the arguments
14671467
@overload # type: ignore[override]
1468-
def __and__( # type: ignore[overload-overlap]
1468+
def __and__( # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
14691469
self, other: bool | list[bool] | list[int] | np_ndarray_bool | Series[bool]
14701470
) -> Series[bool]: ...
14711471
@overload
@@ -1499,7 +1499,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
14991499
def __pow__(self, other: num | _ListLike | Series[S1]) -> Series[S1]: ...
15001500
# ignore needed for mypy as we want different results based on the arguments
15011501
@overload # type: ignore[override]
1502-
def __or__( # type: ignore[overload-overlap]
1502+
def __or__( # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
15031503
self, other: bool | list[bool] | list[int] | np_ndarray_bool | Series[bool]
15041504
) -> Series[bool]: ...
15051505
@overload
@@ -1512,7 +1512,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
15121512
def __radd__(self, other: num | _str | _ListLike | Series) -> Series: ...
15131513
# ignore needed for mypy as we want different results based on the arguments
15141514
@overload # type: ignore[override]
1515-
def __rand__( # type: ignore[overload-overlap]
1515+
def __rand__( # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
15161516
self, other: bool | list[bool] | list[int] | np_ndarray_bool | Series[bool]
15171517
) -> Series[bool]: ...
15181518
@overload
@@ -1526,7 +1526,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
15261526
def __rpow__(self, other: num | _ListLike | Series[S1]) -> Series[S1]: ...
15271527
# ignore needed for mypy as we want different results based on the arguments
15281528
@overload # type: ignore[override]
1529-
def __ror__( # type: ignore[overload-overlap]
1529+
def __ror__( # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
15301530
self, other: bool | list[bool] | list[int] | np_ndarray_bool | Series[bool]
15311531
) -> Series[bool]: ...
15321532
@overload
@@ -1535,7 +1535,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
15351535
def __rtruediv__(self, other: num | _ListLike | Series[S1]) -> Series: ...
15361536
# ignore needed for mypy as we want different results based on the arguments
15371537
@overload # type: ignore[override]
1538-
def __rxor__( # type: ignore[overload-overlap]
1538+
def __rxor__( # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
15391539
self, other: bool | list[bool] | list[int] | np_ndarray_bool | Series[bool]
15401540
) -> Series[bool]: ...
15411541
@overload
@@ -1559,7 +1559,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
15591559
def __truediv__(self, other: num | _ListLike | Series[S1]) -> Series: ...
15601560
# ignore needed for mypy as we want different results based on the arguments
15611561
@overload # type: ignore[override]
1562-
def __xor__( # type: ignore[overload-overlap]
1562+
def __xor__( # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
15631563
self, other: bool | list[bool] | list[int] | np_ndarray_bool | Series[bool]
15641564
) -> Series[bool]: ...
15651565
@overload

pyproject.toml

+1-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ mypy = "1.8.0"
3939
pandas = "2.1.4"
4040
pyarrow = ">=10.0.1"
4141
pytest = ">=7.1.2"
42-
pyright = ">=1.1.343"
42+
pyright = ">=1.1.344"
4343
poethepoet = ">=0.16.5"
4444
loguru = ">=0.6.0"
4545
typing-extensions = ">=4.4.0"
@@ -208,4 +208,3 @@ filterwarnings = [
208208

209209
# Next line needed to avoid poetry complaint
210210
[tool.setuptools_scm]
211-

0 commit comments

Comments
 (0)