Skip to content
Open
Show file tree
Hide file tree
Changes from 6 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
16 changes: 8 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@ minimum_pre_commit_version: 2.15.0
ci:
autofix_prs: false
repos:
- repo: https://github.com/psf/black
rev: 25.9.0
hooks:
- id: black
- repo: https://github.com/PyCQA/isort
rev: 6.0.1
hooks:
- id: isort
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.13.3
hooks:
Expand All @@ -21,3 +13,11 @@ repos:
- id: codespell
additional_dependencies: [ tomli ]
args: [-L, "THIRDPARTY"]
- repo: https://github.com/PyCQA/isort
rev: 6.0.1
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 25.9.0
hooks:
- id: black
3 changes: 2 additions & 1 deletion conftest.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from collections.abc import Generator
import gc

import pytest


@pytest.fixture
def mpl_cleanup():
def mpl_cleanup() -> Generator[None, None, None]:
"""
Ensure Matplotlib is cleaned up around a test.

Expand Down
12 changes: 6 additions & 6 deletions pandas-stubs/_libs/tslibs/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
__all__ = [
"Period",
"Timestamp",
"Timedelta",
"BaseOffset",
"NaT",
"NaTType",
"OutOfBoundsDatetime",
"Period",
"Tick",
"Timedelta",
"Timestamp",
"iNaT",
"nat_strings",
"BaseOffset",
"Tick",
"OutOfBoundsDatetime",
]
from pandas._libs.tslibs.nattype import (
NaT,
Expand Down
1 change: 1 addition & 0 deletions pandas-stubs/_typing.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1080,6 +1080,7 @@ Incomplete: TypeAlias = Any
class Just(Protocol, Generic[T]):
@property # type: ignore[override]
@override
# pyrefly: ignore # bad-override
def __class__(self, /) -> type[T]: ...
@__class__.setter
@override
Expand Down
2 changes: 2 additions & 0 deletions pandas-stubs/core/arrays/categorical.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,10 @@ class Categorical(ExtensionArray):
) -> Categorical: ...
def __len__(self) -> int: ...
def __iter__(self): ...
# pyrefly: ignore # bad-param-name-override
def __contains__(self, key) -> bool: ...
@overload
# pyrefly: ignore # bad-param-name-override
def __getitem__(self, key: ScalarIndexer) -> Any: ...
@overload
def __getitem__(
Expand Down
1 change: 1 addition & 0 deletions pandas-stubs/core/arrays/datetimelike.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class DatetimeLikeArrayMixin(ExtensionOpsMixin, ExtensionArray):
def size(self) -> int: ...
def __len__(self) -> int: ...
@overload
# pyrefly: ignore # bad-param-name-override
def __getitem__(self, key: ScalarIndexer) -> DTScalarOrNaT: ...
@overload
def __getitem__(
Expand Down
1 change: 1 addition & 0 deletions pandas-stubs/core/arrays/interval.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class IntervalArray(IntervalMixin, ExtensionArray):
def __iter__(self): ...
def __len__(self) -> int: ...
@overload
# pyrefly: ignore # bad-param-name-override
def __getitem__(self, key: ScalarIndexer) -> IntervalOrNA: ...
@overload
def __getitem__(self, key: SequenceIndexer) -> Self: ...
Expand Down
1 change: 1 addition & 0 deletions pandas-stubs/core/arrays/sparse/array.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class SparseArray(ExtensionArray, ExtensionOpsMixin):
def unique(self): ...
def value_counts(self, dropna: bool = True): ...
@overload
# pyrefly: ignore # bad-param-name-override
def __getitem__(self, key: ScalarIndexer) -> Any: ...
@overload
def __getitem__(
Expand Down
8 changes: 8 additions & 0 deletions pandas-stubs/core/frame.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ _T_MUTABLE_MAPPING = TypeVar("_T_MUTABLE_MAPPING", bound=MutableMapping, covaria

class _iLocIndexerFrame(_iLocIndexer, Generic[_T]):
@overload
# pyrefly: ignore # bad-param-name-override
def __getitem__(self, idx: tuple[int, int]) -> Scalar: ...
@overload
def __getitem__(self, idx: IndexingInt) -> Series: ...
Expand All @@ -189,6 +190,7 @@ class _iLocIndexerFrame(_iLocIndexer, Generic[_T]):
| tuple[slice]
),
) -> _T: ...
# pyrefly: ignore # bad-param-name-override
def __setitem__(
self,
idx: (
Expand All @@ -213,6 +215,7 @@ class _iLocIndexerFrame(_iLocIndexer, Generic[_T]):

class _LocIndexerFrame(_LocIndexer, Generic[_T]):
@overload
# pyrefly: ignore # bad-param-name-override
def __getitem__(self, idx: Scalar) -> Series | _T: ...
@overload
def __getitem__( # type: ignore[overload-overlap]
Expand Down Expand Up @@ -266,6 +269,7 @@ class _LocIndexerFrame(_LocIndexer, Generic[_T]):
@overload
def __getitem__(self, idx: tuple[Scalar, slice]) -> Series | _T: ...
@overload
# pyrefly: ignore # bad-param-name-override
def __setitem__(
self,
idx: (
Expand All @@ -291,14 +295,17 @@ class _LocIndexerFrame(_LocIndexer, Generic[_T]):
) -> None: ...

class _iAtIndexerFrame(_iAtIndexer):
# pyrefly: ignore # bad-param-name-override
def __getitem__(self, idx: tuple[int, int]) -> Scalar: ...
# pyrefly: ignore # bad-param-name-override
def __setitem__(
self,
idx: tuple[int, int],
value: Scalar | NAType | NaTType | None,
) -> None: ...

class _AtIndexerFrame(_AtIndexer):
# pyrefly: ignore # bad-param-name-override
def __getitem__(
self,
idx: tuple[
Expand All @@ -310,6 +317,7 @@ class _AtIndexerFrame(_AtIndexer):
int | StrLike | tuple[Scalar, ...],
],
) -> Scalar: ...
# pyrefly: ignore # bad-param-name-override
def __setitem__(
self,
idx: (
Expand Down
4 changes: 2 additions & 2 deletions pandas-stubs/core/groupby/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ from pandas.core.groupby.grouper import Grouper as Grouper

__all__ = [
"DataFrameGroupBy",
"NamedAgg",
"SeriesGroupBy",
"GroupBy",
"Grouper",
"NamedAgg",
"SeriesGroupBy",
]
3 changes: 3 additions & 0 deletions pandas-stubs/core/groupby/generic.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ class SeriesGroupBy(GroupBy[Series[S2]], Generic[S2, ByT]):
def unique(self) -> Series: ...
# Overrides that provide more precise return types over the GroupBy class
@final # type: ignore[misc]
# pyrefly: ignore # bad-override
def __iter__( # pyright: ignore[reportIncompatibleMethodOverride]
self,
) -> Iterator[tuple[ByT, Series[S2]]]: ...
Expand Down Expand Up @@ -448,9 +449,11 @@ class DataFrameGroupBy(GroupBy[DataFrame], Generic[ByT, _TT]):
) -> Series: ... # Series[Axes] but this is not allowed
@property
def dtypes(self) -> Series: ...
# pyrefly: ignore # bad-param-name-override
def __getattr__(self, name: str) -> SeriesGroupBy[Any, ByT]: ...
# Overrides that provide more precise return types over the GroupBy class
@final # type: ignore[misc]
# pyrefly: ignore # bad-override
def __iter__( # pyright: ignore[reportIncompatibleMethodOverride]
self,
) -> Iterator[tuple[ByT, DataFrame]]: ...
Expand Down
1 change: 1 addition & 0 deletions pandas-stubs/core/indexes/datetimes.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class DatetimeIndex(
self, other: timedelta | BaseOffset
) -> Self: ...
@overload # type: ignore[override]
# pyrefly: ignore # bad-override
def __sub__(
self, other: datetime | np.datetime64 | np_ndarray_dt | Self
) -> TimedeltaIndex: ...
Expand Down
1 change: 1 addition & 0 deletions pandas-stubs/core/indexes/interval.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ class IntervalIndex(ExtensionIndex[IntervalT, np.object_], IntervalMixin):
@property
def length(self) -> Index: ...
@overload # type: ignore[override]
# pyrefly: ignore # bad-override
def __getitem__(
self,
idx: (
Expand Down
1 change: 1 addition & 0 deletions pandas-stubs/core/indexes/multi.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ class MultiIndex(Index):
def levshape(self): ...
def __reduce__(self): ...
@overload # type: ignore[override]
# pyrefly: ignore # bad-override
def __getitem__(
self,
idx: slice | np_ndarray_anyint | Sequence[int] | Index | MaskType,
Expand Down
2 changes: 2 additions & 0 deletions pandas-stubs/core/indexes/period.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class PeriodIndex(DatetimeIndexOpsMixin[pd.Period, np.object_], PeriodIndexField
self, other: datetime.timedelta
) -> Self: ...
@overload # type: ignore[override]
# pyrefly: ignore # bad-override
def __sub__(self, other: Period) -> Index: ...
@overload
def __sub__(self, other: Self) -> Index: ...
Expand All @@ -55,6 +56,7 @@ class PeriodIndex(DatetimeIndexOpsMixin[pd.Period, np.object_], PeriodIndexField
self, other: TimedeltaIndex | pd.Timedelta
) -> Self: ...
@overload # type: ignore[override]
# pyrefly: ignore # bad-override
def __rsub__(self, other: Period) -> Index: ...
@overload
def __rsub__(self, other: Self) -> Index: ...
Expand Down
1 change: 1 addition & 0 deletions pandas-stubs/core/indexes/range.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class RangeIndex(_IndexSubclassBase[int, np.int64]):
self, other: list[HashableT] | Index, sort: bool | None = None
) -> Index | Index[int] | RangeIndex: ...
@overload # type: ignore[override]
# pyrefly: ignore # bad-override
def __getitem__(
self,
idx: slice | np_ndarray_anyint | Sequence[int] | Index | MaskType,
Expand Down
5 changes: 5 additions & 0 deletions pandas-stubs/core/indexes/timedeltas.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class TimedeltaIndex(
# various ignores needed for mypy, as we do want to restrict what can be used in
# arithmetic for these types
@overload # type: ignore[override]
# pyrefly: ignore # bad-override
def __add__(self, other: Period) -> PeriodIndex: ...
@overload
def __add__(self, other: dt.datetime | DatetimeIndex) -> DatetimeIndex: ...
Expand All @@ -64,6 +65,7 @@ class TimedeltaIndex(
self, other: dt.timedelta | Self
) -> Self: ...
@overload # type: ignore[override]
# pyrefly: ignore # bad-override
def __radd__(self, other: Period) -> PeriodIndex: ...
@overload
def __radd__(self, other: dt.datetime | DatetimeIndex) -> DatetimeIndex: ...
Expand All @@ -75,6 +77,7 @@ class TimedeltaIndex(
self, other: dt.timedelta | np.timedelta64 | np_ndarray_td | BaseOffset | Self
) -> Self: ...
@overload # type: ignore[override]
# pyrefly: ignore # bad-override
def __rsub__(
self, other: dt.timedelta | np.timedelta64 | np_ndarray_td | BaseOffset | Self
) -> Self: ...
Expand Down Expand Up @@ -115,13 +118,15 @@ class TimedeltaIndex(
),
) -> Self: ...
@overload # type: ignore[override]
# pyrefly: ignore # bad-override
def __truediv__(self, other: float | Sequence[float]) -> Self: ...
@overload
def __truediv__( # pyright: ignore[reportIncompatibleMethodOverride]
self, other: dt.timedelta | Sequence[dt.timedelta]
) -> Index[float]: ...
def __rtruediv__(self, other: dt.timedelta | Sequence[dt.timedelta]) -> Index[float]: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride]
@overload # type: ignore[override]
# pyrefly: ignore # bad-override
def __floordiv__(self, other: num | Sequence[float]) -> Self: ...
@overload
def __floordiv__( # pyright: ignore[reportIncompatibleMethodOverride]
Expand Down
9 changes: 9 additions & 0 deletions pandas-stubs/core/series.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,13 @@ class SupportsTruedivInt(Protocol[_T_co]):
class _iLocIndexerSeries(_iLocIndexer, Generic[S1]):
# get item
@overload
# pyrefly: ignore # bad-param-name-override
def __getitem__(self, idx: IndexingInt) -> S1: ...
@overload
def __getitem__(self, idx: Index | slice | np_ndarray_anyint) -> Series[S1]: ...
# set item
@overload
# pyrefly: ignore # bad-param-name-override
def __setitem__(self, idx: int, value: S1 | None) -> None: ...
@overload
def __setitem__(
Expand Down Expand Up @@ -272,6 +274,7 @@ class _LocIndexerSeries(_LocIndexer, Generic[S1]):
# be s.loc[1, :], or s.loc[pd.IndexSlice[1, :]]
) -> Series[S1]: ...
@overload
# pyrefly: ignore # bad-param-name-override
def __setitem__(
self,
idx: Index | MaskType | slice,
Expand Down Expand Up @@ -2208,6 +2211,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
) -> Series[_str]: ...
# ignore needed for mypy as we want different results based on the arguments
@overload # type: ignore[override]
# pyrefly: ignore # bad-override
def __and__( # pyright: ignore[reportOverlappingOverload]
self, other: bool | list[int] | MaskType
) -> Series[bool]: ...
Expand Down Expand Up @@ -3060,13 +3064,15 @@ 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]
# pyrefly: ignore # bad-override
def __or__( # pyright: ignore[reportOverlappingOverload]
self, other: bool | list[int] | MaskType
) -> Series[bool]: ...
@overload
def __or__(self, other: int | np_ndarray_anyint | Series[int]) -> Series[int]: ...
# ignore needed for mypy as we want different results based on the arguments
@overload # type: ignore[override]
# pyrefly: ignore # bad-override
def __rand__( # pyright: ignore[reportOverlappingOverload]
self, other: bool | MaskType | list[int]
) -> Series[bool]: ...
Expand All @@ -3077,13 +3083,15 @@ 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]
# pyrefly: ignore # bad-override
def __ror__( # pyright: ignore[reportOverlappingOverload]
self, other: bool | MaskType | list[int]
) -> Series[bool]: ...
@overload
def __ror__(self, other: int | np_ndarray_anyint | Series[int]) -> Series[int]: ...
# ignore needed for mypy as we want different results based on the arguments
@overload # type: ignore[override]
# pyrefly: ignore # bad-override
def __rxor__( # pyright: ignore[reportOverlappingOverload]
self, other: bool | MaskType | list[int]
) -> Series[bool]: ...
Expand Down Expand Up @@ -4244,6 +4252,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
rdiv = rtruediv
# ignore needed for mypy as we want different results based on the arguments
@overload # type: ignore[override]
# pyrefly: ignore # bad-override
def __xor__( # pyright: ignore[reportOverlappingOverload]
self, other: bool | MaskType | list[int]
) -> Series[bool]: ...
Expand Down
2 changes: 1 addition & 1 deletion pandas-stubs/testing.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ from pandas._testing import (
__all__ = [
"assert_extension_array_equal",
"assert_frame_equal",
"assert_series_equal",
"assert_index_equal",
"assert_series_equal",
]
Loading