From 5fba078a21952d6d21f18456cfbcce9a2d2a2062 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Mon, 14 Oct 2024 15:18:59 +0200 Subject: [PATCH] Update ruff to 0.6.9 (#17940) https://github.com/astral-sh/ruff/blob/0.6.9/CHANGELOG.md --- .pre-commit-config.yaml | 2 +- mypy/fastparse.py | 2 +- mypy/ipc.py | 3 +-- mypy/server/astmerge.py | 2 +- mypy/stubtest.py | 2 +- mypy/util.py | 3 +-- pyproject.toml | 2 ++ test-requirements.in | 2 +- test-requirements.txt | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 14b6dc17b6d8..4efed772396e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,7 +11,7 @@ repos: - id: black exclude: '^(test-data/)' - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.2.0 # must match test-requirements.txt + rev: v0.6.9 # must match test-requirements.txt hooks: - id: ruff args: [--exit-non-zero-on-fix] diff --git a/mypy/fastparse.py b/mypy/fastparse.py index 726397adb849..bc5b1ba8e57a 100644 --- a/mypy/fastparse.py +++ b/mypy/fastparse.py @@ -2033,7 +2033,7 @@ def visit_UnaryOp(self, n: UnaryOp) -> Type: if ( isinstance(typ, RawExpressionType) # Use type() because we do not want to allow bools. - and type(typ.literal_value) is int # noqa: E721 + and type(typ.literal_value) is int ): if isinstance(n.op, USub): typ.literal_value *= -1 diff --git a/mypy/ipc.py b/mypy/ipc.py index ab01f1b79e7d..991f9ac56652 100644 --- a/mypy/ipc.py +++ b/mypy/ipc.py @@ -17,9 +17,8 @@ if sys.platform == "win32": # This may be private, but it is needed for IPC on Windows, and is basically stable - import ctypes - import _winapi + import ctypes _IPCHandle = int diff --git a/mypy/server/astmerge.py b/mypy/server/astmerge.py index 174c2922c767..5dc254422328 100644 --- a/mypy/server/astmerge.py +++ b/mypy/server/astmerge.py @@ -160,7 +160,7 @@ def replacement_map_from_symbol_table( ): new_node = new[name] if ( - type(new_node.node) == type(node.node) # noqa: E721 + type(new_node.node) == type(node.node) and new_node.node and node.node and new_node.node.fullname == node.node.fullname diff --git a/mypy/stubtest.py b/mypy/stubtest.py index 65730828ad9f..756f90dccf2e 100644 --- a/mypy/stubtest.py +++ b/mypy/stubtest.py @@ -700,7 +700,7 @@ def _verify_arg_default_value( stub_default != runtime_arg.default # We want the types to match exactly, e.g. in case the stub has # True and the runtime has 1 (or vice versa). - or type(stub_default) is not type(runtime_arg.default) # noqa: E721 + or type(stub_default) is not type(runtime_arg.default) ) ): yield ( diff --git a/mypy/util.py b/mypy/util.py index 4b1b918b92e6..d2cba9b7a662 100644 --- a/mypy/util.py +++ b/mypy/util.py @@ -15,9 +15,8 @@ from typing_extensions import Literal try: - import curses - import _curses # noqa: F401 + import curses CURSES_ENABLED = True except ImportError: diff --git a/pyproject.toml b/pyproject.toml index 12a0dc109cd5..7e1556357998 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -66,8 +66,10 @@ ignore = [ "E2", # conflicts with black "E402", # module level import not at top of file "E501", # conflicts with black + "E721", # Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks "E731", # Do not assign a `lambda` expression, use a `def` "E741", # Ambiguous variable name + "UP031", # Use format specifiers instead of percent format "UP032", # 'f-string always preferable to format' is controversial "C416", # There are a few cases where it's nice to have names for the dict items ] diff --git a/test-requirements.in b/test-requirements.in index 686dbba3b4de..b008522edebc 100644 --- a/test-requirements.in +++ b/test-requirements.in @@ -12,6 +12,6 @@ psutil>=4.0 pytest>=8.1.0 pytest-xdist>=1.34.0 pytest-cov>=2.10.0 -ruff==0.2.0 # must match version in .pre-commit-config.yaml +ruff==0.6.9 # must match version in .pre-commit-config.yaml setuptools>=65.5.1 tomli>=1.1.0 # needed even on py311+ so the self check passes with --python-version 3.8 diff --git a/test-requirements.txt b/test-requirements.txt index 6e89e473bcb2..56cebf95bfde 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -45,7 +45,7 @@ pytest-cov==4.1.0 # via -r test-requirements.in pytest-xdist==3.3.1 # via -r test-requirements.in -ruff==0.2.0 +ruff==0.6.9 # via -r test-requirements.in tomli==2.0.1 # via -r test-requirements.in