Skip to content

Commit 1cdecd9

Browse files
authored
refactor(ruff): switch from select to ignore (#1412)
* chore(ruff): add rules * refactor(ruff): safe * refactor(ruff): unsafe * fix: typing * fix: conftest * fix: pyrefly * fix: pyrefly * fix(comment): C417 https://github.com/pandas-dev/pandas-stubs/pull/1412/files#r2410872686 * chore(ruff): SLF001 * feat(ruff): S301 * fix(ruff): TD004 * chore(ruff): ERA, S * fix(ruff): tweak rules * chore: pyrefly and mypy * fix(comment): B009 https://github.com/pandas-dev/pandas-stubs/pull/1412/files/85ab0f97c59b7aa7f5f58d5323f91f6063fb192c#r2410965434 * chore: ANN
1 parent c73ec4c commit 1cdecd9

26 files changed

+155
-94
lines changed

.pre-commit-config.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,6 @@ minimum_pre_commit_version: 2.15.0
22
ci:
33
autofix_prs: false
44
repos:
5-
- repo: https://github.com/psf/black
6-
rev: 25.9.0
7-
hooks:
8-
- id: black
9-
- repo: https://github.com/PyCQA/isort
10-
rev: 6.0.1
11-
hooks:
12-
- id: isort
135
- repo: https://github.com/astral-sh/ruff-pre-commit
146
rev: v0.13.3
157
hooks:
@@ -21,3 +13,11 @@ repos:
2113
- id: codespell
2214
additional_dependencies: [ tomli ]
2315
args: [-L, "THIRDPARTY"]
16+
- repo: https://github.com/PyCQA/isort
17+
rev: 6.0.1
18+
hooks:
19+
- id: isort
20+
- repo: https://github.com/psf/black
21+
rev: 25.9.0
22+
hooks:
23+
- id: black

conftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
from collections.abc import Generator
12
import gc
23

34
import pytest
45

56

67
@pytest.fixture
7-
def mpl_cleanup():
8+
def mpl_cleanup() -> Generator[None, None, None]:
89
"""
910
Ensure Matplotlib is cleaned up around a test.
1011

pandas-stubs/_libs/tslibs/__init__.pyi

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
__all__ = [
2-
"Period",
3-
"Timestamp",
4-
"Timedelta",
2+
"BaseOffset",
53
"NaT",
64
"NaTType",
5+
"OutOfBoundsDatetime",
6+
"Period",
7+
"Tick",
8+
"Timedelta",
9+
"Timestamp",
710
"iNaT",
811
"nat_strings",
9-
"BaseOffset",
10-
"Tick",
11-
"OutOfBoundsDatetime",
1212
]
1313
from pandas._libs.tslibs.nattype import (
1414
NaT,

pandas-stubs/_typing.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,6 +1080,7 @@ Incomplete: TypeAlias = Any
10801080
class Just(Protocol, Generic[T]):
10811081
@property # type: ignore[override]
10821082
@override
1083+
# pyrefly: ignore # bad-override
10831084
def __class__(self, /) -> type[T]: ...
10841085
@__class__.setter
10851086
@override

pandas-stubs/core/groupby/__init__.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ from pandas.core.groupby.grouper import Grouper as Grouper
88

99
__all__ = [
1010
"DataFrameGroupBy",
11-
"NamedAgg",
12-
"SeriesGroupBy",
1311
"GroupBy",
1412
"Grouper",
13+
"NamedAgg",
14+
"SeriesGroupBy",
1515
]

pandas-stubs/core/groupby/generic.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ class SeriesGroupBy(GroupBy[Series[S2]], Generic[S2, ByT]):
204204
def unique(self) -> Series: ...
205205
# Overrides that provide more precise return types over the GroupBy class
206206
@final # type: ignore[misc]
207+
# pyrefly: ignore # bad-override
207208
def __iter__( # pyright: ignore[reportIncompatibleMethodOverride]
208209
self,
209210
) -> Iterator[tuple[ByT, Series[S2]]]: ...
@@ -451,6 +452,7 @@ class DataFrameGroupBy(GroupBy[DataFrame], Generic[ByT, _TT]):
451452
def __getattr__(self, name: str) -> SeriesGroupBy[Any, ByT]: ...
452453
# Overrides that provide more precise return types over the GroupBy class
453454
@final # type: ignore[misc]
455+
# pyrefly: ignore # bad-override
454456
def __iter__( # pyright: ignore[reportIncompatibleMethodOverride]
455457
self,
456458
) -> Iterator[tuple[ByT, DataFrame]]: ...

pandas-stubs/core/indexes/datetimes.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ class DatetimeIndex(
6868
self, other: timedelta | BaseOffset
6969
) -> Self: ...
7070
@overload # type: ignore[override]
71+
# pyrefly: ignore # bad-override
7172
def __sub__(
7273
self, other: datetime | np.datetime64 | np_ndarray_dt | Self
7374
) -> TimedeltaIndex: ...

pandas-stubs/core/indexes/interval.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ class IntervalIndex(ExtensionIndex[IntervalT, np.object_], IntervalMixin):
239239
@property
240240
def length(self) -> Index: ...
241241
@overload # type: ignore[override]
242+
# pyrefly: ignore # bad-override
242243
def __getitem__(
243244
self,
244245
idx: (

pandas-stubs/core/indexes/multi.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ class MultiIndex(Index):
123123
def levshape(self): ...
124124
def __reduce__(self): ...
125125
@overload # type: ignore[override]
126+
# pyrefly: ignore # bad-override
126127
def __getitem__(
127128
self,
128129
idx: slice | np_ndarray_anyint | Sequence[int] | Index | MaskType,

pandas-stubs/core/indexes/period.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class PeriodIndex(DatetimeIndexOpsMixin[pd.Period, np.object_], PeriodIndexField
4343
self, other: datetime.timedelta
4444
) -> Self: ...
4545
@overload # type: ignore[override]
46+
# pyrefly: ignore # bad-override
4647
def __sub__(self, other: Period) -> Index: ...
4748
@overload
4849
def __sub__(self, other: Self) -> Index: ...
@@ -55,6 +56,7 @@ class PeriodIndex(DatetimeIndexOpsMixin[pd.Period, np.object_], PeriodIndexField
5556
self, other: TimedeltaIndex | pd.Timedelta
5657
) -> Self: ...
5758
@overload # type: ignore[override]
59+
# pyrefly: ignore # bad-override
5860
def __rsub__(self, other: Period) -> Index: ...
5961
@overload
6062
def __rsub__(self, other: Self) -> Index: ...

0 commit comments

Comments
 (0)