Migrate from autoflake, black, isort, pyupgrade, flake8 and pydocstyle, to ruff (#11911)

ruff is faster and handle everything we had prior.

isort configuration done based on the indication from
https://github.com/astral-sh/ruff/issues/4670, previousely based on
reorder-python-import (#11896)

flake8-docstrings was a wrapper around pydocstyle (now archived) that
explicitly asks to use ruff in https://github.com/PyCQA/pydocstyle/pull/658.

flake8-typing-import is useful mainly for project that support python 3.7
and the one useful check will be implemented in https://github.com/astral-sh/ruff/issues/2302

We need to keep blacken-doc because ruff does not handle detection
of python code inside .md and .rst. The direct link to the repo is
now used to avoid a redirection.

Manual fixes:
- Lines that became too long
- % formatting that was not done automatically
- type: ignore that were moved around
- noqa of hard to fix issues (UP031 generally)
- fmt: off and fmt: on that is not really identical
  between black and ruff
- autofix re-order in pre-commit from faster to slower

Co-authored-by: Ran Benita <ran@unusedvar.com>
This commit is contained in:
Pierre Sassoulas
2024-02-02 20:21:46 +01:00
committed by GitHub
parent 368cc6225e
commit c11cdfabd1
151 changed files with 789 additions and 955 deletions

View File

@@ -3,8 +3,8 @@ import multiprocessing
import os
import sys
import time
import warnings
from unittest import mock
import warnings
from py import error
from py.path import local
@@ -182,7 +182,7 @@ class CommonFSTests:
def test_listdir_filter(self, path1):
p = path1.listdir(lambda x: x.check(dir=1))
assert path1.join("sampledir") in p
assert not path1.join("samplefile") in p
assert path1.join("samplefile") not in p
def test_listdir_sorted(self, path1):
p = path1.listdir(lambda x: x.check(basestarts="sample"), sort=True)
@@ -202,7 +202,7 @@ class CommonFSTests:
for i in path1.visit(None, lambda x: x.basename != "sampledir"):
lst.append(i.relto(path1))
assert "sampledir" in lst
assert not path1.sep.join(["sampledir", "otherfile"]) in lst
assert path1.sep.join(["sampledir", "otherfile"]) not in lst
@pytest.mark.parametrize(
"fil",