Skip to content

Commit c73a92f

Browse files
XuehaiPanpytorchmergebot
authored andcommittedFeb 27, 2025
[BE][CI] bump ruff to 0.9.2: multiline assert statements (pytorch#144546)
Reference: https://docs.astral.sh/ruff/formatter/black/#assert-statements > Unlike Black, Ruff prefers breaking the message over breaking the assertion, similar to how both Ruff and Black prefer breaking the assignment value over breaking the assignment target: > > ```python > # Input > assert ( > len(policy_types) >= priority + num_duplicates > ), f"This tests needs at least {priority+num_duplicates} many types." > > > # Black > assert ( > len(policy_types) >= priority + num_duplicates > ), f"This tests needs at least {priority+num_duplicates} many types." > > # Ruff > assert len(policy_types) >= priority + num_duplicates, ( > f"This tests needs at least {priority + num_duplicates} many types." > ) > ``` Pull Request resolved: pytorch#144546 Approved by: https://github.com/malfet
1 parent f0d0042 commit c73a92f

File tree

84 files changed

+634
-622
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+634
-622
lines changed
 

‎.github/scripts/label_utils.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ def gh_get_labels(org: str, repo: str) -> list[str]:
6363
update_labels(labels, info)
6464

6565
last_page = get_last_page_num_from_header(header)
66-
assert (
67-
last_page > 0
68-
), "Error reading header info to determine total number of pages of labels"
66+
assert last_page > 0, (
67+
"Error reading header info to determine total number of pages of labels"
68+
)
6969
for page_number in range(2, last_page + 1): # skip page 1
7070
_, info = request_for_labels(prefix + f"&page={page_number}")
7171
update_labels(labels, info)

‎.lintrunner.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1476,7 +1476,7 @@ init_command = [
14761476
'black==23.12.1',
14771477
'usort==1.0.8.post1',
14781478
'isort==5.13.2',
1479-
'ruff==0.8.4', # sync with RUFF
1479+
'ruff==0.9.2', # sync with RUFF
14801480
]
14811481
is_formatter = true
14821482

@@ -1561,7 +1561,7 @@ init_command = [
15611561
'python3',
15621562
'tools/linter/adapters/pip_init.py',
15631563
'--dry-run={{DRYRUN}}',
1564-
'ruff==0.8.4', # sync with PYFMT
1564+
'ruff==0.9.2', # sync with PYFMT
15651565
]
15661566
is_formatter = true
15671567

0 commit comments

Comments
 (0)
Please sign in to comment.