Skip to content

Commit d460abd

Browse files
tqa236mroeschke
andauthored
Migrate pylint to ruff (#57182)
Configure ruff pylint Co-authored-by: Matthew Roeschke <[email protected]>
1 parent f56cba9 commit d460abd

File tree

28 files changed

+80
-259
lines changed

28 files changed

+80
-259
lines changed

.github/workflows/code-checks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ jobs:
8585
echo "PYTHONPATH=$PYTHONPATH" >> $GITHUB_ENV
8686
if: ${{ steps.build.outcome == 'success' && always() }}
8787

88-
- name: Typing + pylint
88+
- name: Typing
8989
uses: pre-commit/[email protected]
9090
with:
9191
extra_args: --verbose --hook-stage manual --all-files

.pre-commit-config.yaml

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ ci:
1616
autofix_prs: false
1717
autoupdate_schedule: monthly
1818
# manual stage hooks
19-
skip: [pylint, pyright, mypy]
19+
skip: [pyright, mypy]
2020
repos:
2121
- repo: https://github.com/astral-sh/ruff-pre-commit
2222
rev: v0.3.4
@@ -67,25 +67,6 @@ repos:
6767
- id: fix-encoding-pragma
6868
args: [--remove]
6969
- id: trailing-whitespace
70-
- repo: https://github.com/pylint-dev/pylint
71-
rev: v3.0.1
72-
hooks:
73-
- id: pylint
74-
stages: [manual]
75-
args: [--load-plugins=pylint.extensions.redefined_loop_name, --fail-on=I0021]
76-
- id: pylint
77-
alias: redefined-outer-name
78-
name: Redefining name from outer scope
79-
files: ^pandas/
80-
exclude: |
81-
(?x)
82-
^pandas/tests # keep excluded
83-
|/_testing/ # keep excluded
84-
|^pandas/util/_test_decorators\.py # keep excluded
85-
|^pandas/_version\.py # keep excluded
86-
|^pandas/conftest\.py # keep excluded
87-
args: [--disable=all, --enable=redefined-outer-name]
88-
stages: [manual]
8970
- repo: https://github.com/PyCQA/isort
9071
rev: 5.13.2
9172
hooks:

pandas/_libs/tslibs/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"is_supported_dtype",
3737
]
3838

39-
from pandas._libs.tslibs import dtypes # pylint: disable=import-self
39+
from pandas._libs.tslibs import dtypes
4040
from pandas._libs.tslibs.conversion import localize_pydatetime
4141
from pandas._libs.tslibs.dtypes import (
4242
Resolution,

pandas/core/arrays/categorical.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2482,7 +2482,6 @@ def unique(self) -> Self:
24822482
['b', 'a']
24832483
Categories (3, object): ['a' < 'b' < 'c']
24842484
"""
2485-
# pylint: disable=useless-parent-delegation
24862485
return super().unique()
24872486

24882487
def _cast_quantile_result(self, res_values: np.ndarray) -> np.ndarray:

pandas/core/arrays/datetimelike.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,6 @@ def view(self, dtype: Literal["m8[ns]"]) -> TimedeltaArray: ...
506506
@overload
507507
def view(self, dtype: Dtype | None = ...) -> ArrayLike: ...
508508

509-
# pylint: disable-next=useless-parent-delegation
510509
def view(self, dtype: Dtype | None = None) -> ArrayLike:
511510
# we need to explicitly call super() method as long as the `@overload`s
512511
# are present in this file.

pandas/core/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def __sizeof__(self) -> int:
127127
"""
128128
memory_usage = getattr(self, "memory_usage", None)
129129
if memory_usage:
130-
mem = memory_usage(deep=True) # pylint: disable=not-callable
130+
mem = memory_usage(deep=True)
131131
return int(mem if is_scalar(mem) else mem.sum())
132132

133133
# no memory_usage attribute, so fall back to object's 'sizeof'

pandas/core/dtypes/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ def is_scipy_sparse(arr) -> bool:
250250
"""
251251
global _is_scipy_sparse
252252

253-
if _is_scipy_sparse is None: # pylint: disable=used-before-assignment
253+
if _is_scipy_sparse is None:
254254
try:
255255
from scipy.sparse import issparse as _is_scipy_sparse
256256
except ImportError:

pandas/core/groupby/groupby.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5014,7 +5014,7 @@ def shift(
50145014
period = cast(int, period)
50155015
if freq is not None:
50165016
f = lambda x: x.shift(
5017-
period, # pylint: disable=cell-var-from-loop
5017+
period,
50185018
freq,
50195019
0, # axis
50205020
fill_value,

pandas/core/indexes/multi.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2803,7 +2803,6 @@ def get_slice_bound(
28032803
label = (label,)
28042804
return self._partial_tup_index(label, side=side)
28052805

2806-
# pylint: disable-next=useless-parent-delegation
28072806
def slice_locs(self, start=None, end=None, step=None) -> tuple[int, int]:
28082807
"""
28092808
For an ordered MultiIndex, compute the slice locations for input

pandas/core/internals/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
)
77

88
__all__ = [
9-
"Block", # pylint: disable=undefined-all-variable
10-
"DatetimeTZBlock", # pylint: disable=undefined-all-variable
11-
"ExtensionBlock", # pylint: disable=undefined-all-variable
9+
"Block",
10+
"DatetimeTZBlock",
11+
"ExtensionBlock",
1212
"make_block",
1313
"BlockManager",
1414
"SingleBlockManager",

0 commit comments

Comments
 (0)