Skip to content

Commit e73307f

Browse files
committed
Translate config with pylint-to-ruff
1 parent b16206d commit e73307f

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
@@ -4963,7 +4963,7 @@ def _sanitize_column(self, value) -> tuple[ArrayLike, BlockValuesRefs | None]:
49634963
isinstance(value, Index)
49644964
and value.dtype == "object"
49654965
and arr.dtype != value.dtype
4966-
): #
4966+
):
49674967
# TODO: Remove kludge in sanitize_array for string mode when enforcing
49684968
# this deprecation
49694969
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
@@ -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 = [
@@ -378,7 +474,6 @@ exclude = [
378474
[tool.ruff.lint.flake8-tidy-imports.banned-api]
379475
"urllib.request.urlopen".msg = "Use pandas.io.common.urlopen instead of urllib.request.urlopen"
380476

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

0 commit comments

Comments
 (0)