Skip to content

Commit

Permalink
ruff: ignore specific python2 rules for setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
giampaolo committed Dec 20, 2024
1 parent fffaba3 commit 93318fa
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
19 changes: 16 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,28 @@ ignore = [
]

[tool.ruff.lint.per-file-ignores]
# T201 == print(), T203 == pprint()
# EM101 == raw-string-in-exception
# T201 == print(), T203 == pprint()
# TRY003 == raise-vanilla-args
# EM102 == Exception must not use an f-string literal, assign to variable first
".github/workflows/*" = ["EM102", "T201", "T203"]
"psutil/tests/*" = ["EM101", "EM102", "TRY003"]
"scripts/*" = ["EM102", "T201", "T203"]
"scripts/internal/*" = ["EM101", "EM102", "T201", "T203", "TRY003"]
"setup.py" = ["T201", "T203"]
"setup.py" = [
"B904", # Use ` raise from` to specify exception cause (PYTHON2.7 COMPAT)
"C4", # flake8-comprehensions (PYTHON2.7 COMPAT)
"FLY", # flynt (PYTHON2.7 COMPAT)
"FURB145", # [*] Prefer `copy` method over slicing (PYTHON2.7 COMPAT)
"T201",
"T203",
"UP009", # [*] UTF-8 encoding declaration is unnecessary (PYTHON2.7 COMPAT)
"UP010", # [*] Unnecessary `__future__` import `print_function` (PYTHON2.7 COMPAT)
"UP024", # [*] Replace aliased errors with `OSError` (PYTHON2.7 COMPAT)
"UP025", # [*] Remove unicode literals from strings (PYTHON2.7 COMPAT)
"UP028", # [*] Replace `yield` over `for` loop with `yield from` (PYTHON2.7 COMPAT)
"UP032", # [*] Use f-string instead of `format` call (PYTHON2.7 COMPAT)
"UP036", # Version block is outdated for minimum Python version
]

[tool.ruff.lint.isort]
# https://beta.ruff.rs/docs/settings/#isort
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
NOTE: the syntax of this script MUST be kept compatible with Python 2.7.
"""

from __future__ import print_function # noqa: UP010
from __future__ import print_function

import ast
import contextlib
Expand All @@ -28,7 +28,7 @@
import warnings


if sys.version_info[0] == 2: # noqa: UP036
if sys.version_info[0] == 2:
sys.exit(textwrap.dedent("""\
As of version 7.0.0 psutil no longer supports Python 2.7, see:
https://github.com/giampaolo/psutil/issues/2480
Expand Down

0 comments on commit 93318fa

Please sign in to comment.