Skip to content

Commit eee07dd

Browse files
committed
Translate config with pylint-to-ruff
1 parent 7e58846 commit eee07dd

File tree

6 files changed

+101
-13
lines changed

6 files changed

+101
-13
lines changed

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ repos:
3131
exclude: ^pandas/tests
3232
args: [--select, "ANN001,ANN2", --fix-only, --exit-non-zero-on-fix]
3333
- id: ruff
34-
args: [--exit-non-zero-on-fix, --preview, "--ignore=E721,F841,RUF025,RUF100,RUF001,E226,RUF003,E203"]
34+
args: [--exit-non-zero-on-fix, --preview, "--ignore=E,F841,RUF"]
3535
- id: ruff-format
3636
exclude: ^scripts
3737
- repo: https://github.com/jendrikseipp/vulture

pandas/core/frame.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4988,7 +4988,7 @@ def _sanitize_column(self, value) -> tuple[ArrayLike, BlockValuesRefs | None]:
49884988
isinstance(value, Index)
49894989
and value.dtype == "object"
49904990
and arr.dtype != value.dtype
4991-
): #
4991+
):
49924992
# TODO: Remove kludge in sanitize_array for string mode when enforcing
49934993
# this deprecation
49944994
warnings.warn(

pandas/tests/extension/decimal/array.py

-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ def to_numpy(
125125
return result
126126

127127
def __array_ufunc__(self, ufunc: np.ufunc, method: str, *inputs, **kwargs):
128-
#
129128
if not all(
130129
isinstance(t, self._HANDLED_TYPES + (DecimalArray,)) for t in inputs
131130
):

pandas/tests/scalar/period/test_period.py

-5
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,6 @@ def test_properties_quarterly(self):
970970
qedec_date = Period(freq="Q-DEC", year=2007, quarter=1)
971971
qejan_date = Period(freq="Q-JAN", year=2007, quarter=1)
972972
qejun_date = Period(freq="Q-JUN", year=2007, quarter=1)
973-
#
974973
for x in range(3):
975974
for qd in (qedec_date, qejan_date, qejun_date):
976975
assert (qd + x).qyear == 2007
@@ -995,7 +994,6 @@ def test_properties_monthly(self):
995994
def test_properties_weekly(self):
996995
# Test properties on Periods with daily frequency.
997996
w_date = Period(freq="W", year=2007, month=1, day=7)
998-
#
999997
assert w_date.year == 2007
1000998
assert w_date.quarter == 1
1001999
assert w_date.month == 1
@@ -1025,7 +1023,6 @@ def test_properties_daily(self):
10251023
# Test properties on Periods with daily frequency.
10261024
with tm.assert_produces_warning(FutureWarning, match=bday_msg):
10271025
b_date = Period(freq="B", year=2007, month=1, day=1)
1028-
#
10291026
assert b_date.year == 2007
10301027
assert b_date.quarter == 1
10311028
assert b_date.month == 1
@@ -1068,7 +1065,6 @@ def test_properties_hourly(self):
10681065
def test_properties_minutely(self):
10691066
# Test properties on Periods with minutely frequency.
10701067
t_date = Period(freq="Min", year=2007, month=1, day=1, hour=0, minute=0)
1071-
#
10721068
assert t_date.quarter == 1
10731069
assert t_date.month == 1
10741070
assert t_date.day == 1
@@ -1087,7 +1083,6 @@ def test_properties_secondly(self):
10871083
s_date = Period(
10881084
freq="Min", year=2007, month=1, day=1, hour=0, minute=0, second=0
10891085
)
1090-
#
10911086
assert s_date.year == 2007
10921087
assert s_date.quarter == 1
10931088
assert s_date.month == 1

pandas/tests/scalar/timestamp/methods/test_round.py

-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ def test_round_dst_border_ambiguous(self, method, unit):
166166
# GH 18946 round near "fall back" DST
167167
ts = Timestamp("2017-10-29 00:00:00", tz="UTC").tz_convert("Europe/Madrid")
168168
ts = ts.as_unit(unit)
169-
#
170169
result = getattr(ts, method)("h", ambiguous=True)
171170
assert result == ts
172171
assert result._creso == getattr(NpyDatetimeUnit, f"NPY_FR_{unit}").value

pyproject.toml

+99-4
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,6 @@ ignore = [
275275
# Use `typing.NamedTuple` instead of `collections.namedtuple`
276276
"PYI024",
277277
# No builtin `eval()` allowed
278-
"PGH001",
279278
# "S307", # flake8-bandit is not enabled yet
280279
# compare-to-empty-string
281280
"PLC1901",
@@ -321,7 +320,6 @@ ignore = [
321320
"RUF012",
322321
# Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks
323322
# "E721",
324-
# "F841",
325323
# Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
326324
"RUF021",
327325
# `__all__` is not sorted
@@ -360,7 +358,105 @@ ignore = [
360358
# Unnecessary lookup of dictionary value by key
361359
"PLR1733",
362360
# Unnecessary lookup of list item by index
363-
"PLR1736"
361+
"PLR1736",
362+
363+
# Output of pylint-to-ruff
364+
# "PLC0103", # invalid-name
365+
# "PLC0114", # missing-module-docstring
366+
# "PLC0115", # missing-class-docstring
367+
# "PLC0116", # missing-function-docstring
368+
# "PLC0121", # singleton-comparison
369+
# "PLC0123", # unidiomatic-typecheck
370+
# "PLC0200", # consider-using-enumerate
371+
# "PLC0204", # bad-mcs-classmethod-argument
372+
# "PLC0302", # too-many-lines
373+
# "PLC0325", # superfluous-parens
374+
# "PLC0411", # wrong-import-order
375+
# "PLC0412", # ungrouped-imports
376+
# "PLC0413", # wrong-import-position
377+
# "PLC0415", # import-outside-toplevel
378+
# "PLC1802", # use-implicit-booleaness-not-len
379+
# "PLC1803", # use-implicit-booleaness-not-comparison
380+
# "PLC1804", # use-implicit-booleaness-not-comparison-to-string
381+
# "PLC1805", # use-implicit-booleaness-not-comparison-to-zero
382+
"PLC2801", # unnecessary-dunder-call
383+
# "PLC3001", # unnecessary-lambda-assignment
384+
# "PLE0110", # abstract-class-instantiated
385+
# "PLE0401", # import-error
386+
# "PLE0601", # used-before-assignment
387+
# "PLE0602", # undefined-variable
388+
# "PLE0611", # no-name-in-module
389+
# "PLE0633", # unpacking-non-sequence
390+
# "PLE1101", # no-member
391+
# "PLE1120", # no-value-for-parameter
392+
# "PLE1121", # too-many-function-args
393+
# "PLE1123", # unexpected-keyword-arg
394+
# "PLE1124", # redundant-keyword-arg
395+
# "PLE1130", # invalid-unary-operand-type
396+
# "PLE1133", # not-an-iterable
397+
# "PLE1135", # unsupported-membership-test
398+
# "PLE1136", # unsubscriptable-object
399+
# "PLE1137", # unsupported-assignment-operation
400+
# "PLI0001", # raw-checker-failed
401+
# "PLI0010", # bad-inline-option
402+
# "PLI0011", # locally-disabled
403+
# "PLI0013", # file-ignored
404+
# "PLI0020", # suppressed-message
405+
# "PLI0021", # useless-suppression
406+
# "PLI0022", # deprecated-pragma
407+
# "PLI0023", # use-symbolic-message-instead
408+
# "PLI1101", # c-extension-no-member
409+
"PLR0124", # comparison-with-itself
410+
# "PLR0401", # cyclic-import
411+
# "PLR0801", # duplicate-code
412+
# "PLR0901", # too-many-ancestors
413+
# "PLR0902", # too-many-instance-attributes
414+
# "PLR0903", # too-few-public-methods
415+
"PLR0904", # too-many-public-methods
416+
"PLR0911", # too-many-return-statements
417+
"PLR0912", # too-many-branches
418+
"PLR0913", # too-many-arguments
419+
"PLR0914", # too-many-locals
420+
"PLR0915", # too-many-statements
421+
"PLR0916", # too-many-boolean-expressions
422+
"PLR1702", # too-many-nested-blocks
423+
"PLR1704", # redefined-argument-from-local
424+
# "PLR1705", # no-else-return
425+
# "PLR1710", # inconsistent-return-statements
426+
# "PLR1720", # no-else-raise
427+
# "PLR1724", # no-else-continue
428+
# "PLR1732", # consider-using-with
429+
# "PLR1735", # use-dict-literal
430+
# "PLW0102", # dangerous-default-value
431+
# "PLW0104", # pointless-statement
432+
# "PLW0106", # expression-not-assigned
433+
"PLW0108", # unnecessary-lambda
434+
# "PLW0123", # eval-used
435+
# "PLW0125", # using-constant-test
436+
# "PLW0143", # comparison-with-callable
437+
# "PLW0201", # attribute-defined-outside-init
438+
# "PLW0212", # protected-access
439+
# "PLW0221", # arguments-differ
440+
# "PLW0222", # signature-differs
441+
# "PLW0223", # abstract-method
442+
# "PLW0231", # super-init-not-called
443+
# "PLW0236", # invalid-overridden-method
444+
# "PLW0237", # arguments-renamed
445+
# "PLW0239", # overridden-final-method
446+
# "PLW0511", # fixme
447+
"PLW0603", # global-statement
448+
# "PLW0613", # unused-argument
449+
# "PLW0621", # redefined-outer-name
450+
# "PLW0622", # redefined-builtin
451+
# "PLW0641", # possibly-unused-variable
452+
# "PLW0642", # self-cls-assignment
453+
# "PLW0706", # try-except-raise
454+
# "PLW0707", # raise-missing-from
455+
# "PLW0718", # broad-exception-caught
456+
# "PLW0719", # broad-exception-raised
457+
# "PLW1113", # keyword-arg-before-vararg
458+
# "PLW1114", # arguments-out-of-order
459+
# "PLW4901", # deprecated-module
364460
]
365461

366462
exclude = [
@@ -389,7 +485,6 @@ exclude = [
389485

390486

391487

392-
[tool.ruff.per-file-ignores]
393488
[tool.ruff.lint.per-file-ignores]
394489
# relative imports allowed for asv_bench
395490
"asv_bench/*" = ["TID", "NPY002"]

0 commit comments

Comments
 (0)