Migrate from autoflake, black, isort, pyupgrade, flake8 and pydocstyle, to ruff
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:
@@ -1,18 +1,19 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import operator
|
||||
from contextlib import contextmanager
|
||||
from decimal import Decimal
|
||||
from fractions import Fraction
|
||||
from math import sqrt
|
||||
import operator
|
||||
from operator import eq
|
||||
from operator import ne
|
||||
from typing import Optional
|
||||
|
||||
import pytest
|
||||
from _pytest.pytester import Pytester
|
||||
from _pytest.python_api import _recursive_sequence_map
|
||||
import pytest
|
||||
from pytest import approx
|
||||
|
||||
|
||||
inf, nan = float("inf"), float("nan")
|
||||
|
||||
|
||||
@@ -38,9 +39,7 @@ def mocked_doctest_runner(monkeypatch):
|
||||
class MyDocTestRunner(doctest.DocTestRunner):
|
||||
def report_failure(self, out, test, example, got):
|
||||
raise AssertionError(
|
||||
"'{}' evaluates to '{}', not '{}'".format(
|
||||
example.source.strip(), got.strip(), example.want.strip()
|
||||
)
|
||||
f"'{example.source.strip()}' evaluates to '{got.strip()}', not '{example.want.strip()}'"
|
||||
)
|
||||
|
||||
return MyDocTestRunner()
|
||||
|
||||
Reference in New Issue
Block a user