Skip to content

Commit 5f5a73f

Browse files
committed
Translate config with pylint-to-ruff
1 parent 009fd1c commit 5f5a73f

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
- repo: https://github.com/jendrikseipp/vulture
3737
rev: v2.11

pandas/core/frame.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5106,7 +5106,7 @@ def _sanitize_column(self, value) -> tuple[ArrayLike, BlockValuesRefs | None]:
51065106
isinstance(value, Index)
51075107
and value.dtype == "object"
51085108
and arr.dtype != value.dtype
5109-
): #
5109+
):
51105110
# TODO: Remove kludge in sanitize_array for string mode when enforcing
51115111
# this deprecation
51125112
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
@@ -968,7 +968,6 @@ def test_properties_quarterly(self):
968968
qedec_date = Period(freq="Q-DEC", year=2007, quarter=1)
969969
qejan_date = Period(freq="Q-JAN", year=2007, quarter=1)
970970
qejun_date = Period(freq="Q-JUN", year=2007, quarter=1)
971-
#
972971
for x in range(3):
973972
for qd in (qedec_date, qejan_date, qejun_date):
974973
assert (qd + x).qyear == 2007
@@ -993,7 +992,6 @@ def test_properties_monthly(self):
993992
def test_properties_weekly(self):
994993
# Test properties on Periods with daily frequency.
995994
w_date = Period(freq="W", year=2007, month=1, day=7)
996-
#
997995
assert w_date.year == 2007
998996
assert w_date.quarter == 1
999997
assert w_date.month == 1
@@ -1023,7 +1021,6 @@ def test_properties_daily(self):
10231021
# Test properties on Periods with daily frequency.
10241022
with tm.assert_produces_warning(FutureWarning, match=bday_msg):
10251023
b_date = Period(freq="B", year=2007, month=1, day=1)
1026-
#
10271024
assert b_date.year == 2007
10281025
assert b_date.quarter == 1
10291026
assert b_date.month == 1
@@ -1066,7 +1063,6 @@ def test_properties_hourly(self):
10661063
def test_properties_minutely(self):
10671064
# Test properties on Periods with minutely frequency.
10681065
t_date = Period(freq="Min", year=2007, month=1, day=1, hour=0, minute=0)
1069-
#
10701066
assert t_date.quarter == 1
10711067
assert t_date.month == 1
10721068
assert t_date.day == 1
@@ -1085,7 +1081,6 @@ def test_properties_secondly(self):
10851081
s_date = Period(
10861082
freq="Min", year=2007, month=1, day=1, hour=0, minute=0, second=0
10871083
)
1088-
#
10891084
assert s_date.year == 2007
10901085
assert s_date.quarter == 1
10911086
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
@@ -276,7 +276,6 @@ ignore = [
276276
# Use `typing.NamedTuple` instead of `collections.namedtuple`
277277
"PYI024",
278278
# No builtin `eval()` allowed
279-
"PGH001",
280279
# "S307", # flake8-bandit is not enabled yet
281280
# compare-to-empty-string
282281
"PLC1901",
@@ -322,7 +321,6 @@ ignore = [
322321
"RUF012",
323322
# Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks
324323
# "E721",
325-
# "F841",
326324
# Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
327325
"RUF021",
328326
# `__all__` is not sorted
@@ -361,7 +359,105 @@ ignore = [
361359
# Unnecessary lookup of dictionary value by key
362360
"PLR1733",
363361
# Unnecessary lookup of list item by index
364-
"PLR1736"
362+
"PLR1736",
363+
364+
# Output of pylint-to-ruff
365+
# "PLC0103", # invalid-name
366+
# "PLC0114", # missing-module-docstring
367+
# "PLC0115", # missing-class-docstring
368+
# "PLC0116", # missing-function-docstring
369+
# "PLC0121", # singleton-comparison
370+
# "PLC0123", # unidiomatic-typecheck
371+
# "PLC0200", # consider-using-enumerate
372+
# "PLC0204", # bad-mcs-classmethod-argument
373+
# "PLC0302", # too-many-lines
374+
# "PLC0325", # superfluous-parens
375+
# "PLC0411", # wrong-import-order
376+
# "PLC0412", # ungrouped-imports
377+
# "PLC0413", # wrong-import-position
378+
# "PLC0415", # import-outside-toplevel
379+
# "PLC1802", # use-implicit-booleaness-not-len
380+
# "PLC1803", # use-implicit-booleaness-not-comparison
381+
# "PLC1804", # use-implicit-booleaness-not-comparison-to-string
382+
# "PLC1805", # use-implicit-booleaness-not-comparison-to-zero
383+
"PLC2801", # unnecessary-dunder-call
384+
# "PLC3001", # unnecessary-lambda-assignment
385+
# "PLE0110", # abstract-class-instantiated
386+
# "PLE0401", # import-error
387+
# "PLE0601", # used-before-assignment
388+
# "PLE0602", # undefined-variable
389+
# "PLE0611", # no-name-in-module
390+
# "PLE0633", # unpacking-non-sequence
391+
# "PLE1101", # no-member
392+
# "PLE1120", # no-value-for-parameter
393+
# "PLE1121", # too-many-function-args
394+
# "PLE1123", # unexpected-keyword-arg
395+
# "PLE1124", # redundant-keyword-arg
396+
# "PLE1130", # invalid-unary-operand-type
397+
# "PLE1133", # not-an-iterable
398+
# "PLE1135", # unsupported-membership-test
399+
# "PLE1136", # unsubscriptable-object
400+
# "PLE1137", # unsupported-assignment-operation
401+
# "PLI0001", # raw-checker-failed
402+
# "PLI0010", # bad-inline-option
403+
# "PLI0011", # locally-disabled
404+
# "PLI0013", # file-ignored
405+
# "PLI0020", # suppressed-message
406+
# "PLI0021", # useless-suppression
407+
# "PLI0022", # deprecated-pragma
408+
# "PLI0023", # use-symbolic-message-instead
409+
# "PLI1101", # c-extension-no-member
410+
"PLR0124", # comparison-with-itself
411+
# "PLR0401", # cyclic-import
412+
# "PLR0801", # duplicate-code
413+
# "PLR0901", # too-many-ancestors
414+
# "PLR0902", # too-many-instance-attributes
415+
# "PLR0903", # too-few-public-methods
416+
"PLR0904", # too-many-public-methods
417+
"PLR0911", # too-many-return-statements
418+
"PLR0912", # too-many-branches
419+
"PLR0913", # too-many-arguments
420+
"PLR0914", # too-many-locals
421+
"PLR0915", # too-many-statements
422+
"PLR0916", # too-many-boolean-expressions
423+
"PLR1702", # too-many-nested-blocks
424+
"PLR1704", # redefined-argument-from-local
425+
# "PLR1705", # no-else-return
426+
# "PLR1710", # inconsistent-return-statements
427+
# "PLR1720", # no-else-raise
428+
# "PLR1724", # no-else-continue
429+
# "PLR1732", # consider-using-with
430+
# "PLR1735", # use-dict-literal
431+
# "PLW0102", # dangerous-default-value
432+
# "PLW0104", # pointless-statement
433+
# "PLW0106", # expression-not-assigned
434+
"PLW0108", # unnecessary-lambda
435+
# "PLW0123", # eval-used
436+
# "PLW0125", # using-constant-test
437+
# "PLW0143", # comparison-with-callable
438+
# "PLW0201", # attribute-defined-outside-init
439+
# "PLW0212", # protected-access
440+
# "PLW0221", # arguments-differ
441+
# "PLW0222", # signature-differs
442+
# "PLW0223", # abstract-method
443+
# "PLW0231", # super-init-not-called
444+
# "PLW0236", # invalid-overridden-method
445+
# "PLW0237", # arguments-renamed
446+
# "PLW0239", # overridden-final-method
447+
# "PLW0511", # fixme
448+
"PLW0603", # global-statement
449+
# "PLW0613", # unused-argument
450+
# "PLW0621", # redefined-outer-name
451+
# "PLW0622", # redefined-builtin
452+
# "PLW0641", # possibly-unused-variable
453+
# "PLW0642", # self-cls-assignment
454+
# "PLW0706", # try-except-raise
455+
# "PLW0707", # raise-missing-from
456+
# "PLW0718", # broad-exception-caught
457+
# "PLW0719", # broad-exception-raised
458+
# "PLW1113", # keyword-arg-before-vararg
459+
# "PLW1114", # arguments-out-of-order
460+
# "PLW4901", # deprecated-module
365461
]
366462

367463
exclude = [
@@ -379,7 +475,6 @@ exclude = [
379475
[tool.ruff.lint.flake8-tidy-imports.banned-api]
380476
"urllib.request.urlopen".msg = "Use pandas.io.common.urlopen instead of urllib.request.urlopen"
381477

382-
[tool.ruff.per-file-ignores]
383478
[tool.ruff.lint.per-file-ignores]
384479
# relative imports allowed for asv_bench
385480
"asv_bench/*" = ["TID", "NPY002"]

0 commit comments

Comments
 (0)