Skip to content

Update ruff to 0.6.9 #17940

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion mypy/fastparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions mypy/ipc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion mypy/server/astmerge.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this use is instead of ==?

Copy link
Collaborator Author

@cdce8p cdce8p Oct 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could although I'm uncertain how mypyc optimizes that and thus what the performance impact would be. That's why I chose to add E721 to the ignore list. There are three more instances which ruff would have suggested to change.

and new_node.node
and node.node
and new_node.node.fullname == node.node.fullname
Expand Down
2 changes: 1 addition & 1 deletion mypy/stubtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
3 changes: 1 addition & 2 deletions mypy/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
from typing_extensions import Literal

try:
import curses

import _curses # noqa: F401
import curses

CURSES_ENABLED = True
except ImportError:
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
]
Expand Down
2 changes: 1 addition & 1 deletion test-requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading