Skip to content

Commit 5b775fe

Browse files
authored
Update ruff version to 0.11.6 (#2103)
Summary: Use more recent versions so people can have less problems when they just install the latest ruff Test Plan: CI Reviewers: Subscribers: Tasks: Tags:
1 parent 896f61b commit 5b775fe

File tree

120 files changed

+1047
-1025
lines changed

Some content is hidden

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

120 files changed

+1047
-1025
lines changed

.github/scripts/github_utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ def gh_fetch_url_and_headers(
5050
):
5151
print(
5252
f"""Rate limit exceeded:
53-
Used: {err.headers['X-RateLimit-Used']}
54-
Limit: {err.headers['X-RateLimit-Limit']}
55-
Remaining: {err.headers['X-RateLimit-Remaining']}
56-
Resets at: {err.headers['x-RateLimit-Reset']}"""
53+
Used: {err.headers["X-RateLimit-Used"]}
54+
Limit: {err.headers["X-RateLimit-Limit"]}
55+
Remaining: {err.headers["X-RateLimit-Remaining"]}
56+
Resets at: {err.headers["x-RateLimit-Reset"]}"""
5757
)
5858
raise
5959

.github/scripts/label_utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ def gh_get_labels(org: str, repo: str) -> List[str]:
6262
update_labels(labels, info)
6363

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

.github/scripts/trymerge.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ def get_check_run_name_prefix(workflow_run: Any) -> str:
490490
if workflow_run is None:
491491
return ""
492492
else:
493-
return f'{workflow_run["workflow"]["name"]} / '
493+
return f"{workflow_run['workflow']['name']} / "
494494

495495

496496
def is_passing_status(status: Optional[str]) -> bool:
@@ -538,7 +538,7 @@ def add_conclusions(edges: Any) -> None:
538538
if not isinstance(checkrun_node, dict):
539539
warn(f"Expected dictionary, but got {type(checkrun_node)}")
540540
continue
541-
checkrun_name = f'{get_check_run_name_prefix(workflow_run)}{checkrun_node["name"]}'
541+
checkrun_name = f"{get_check_run_name_prefix(workflow_run)}{checkrun_node['name']}"
542542
existing_checkrun = workflow_obj.jobs.get(checkrun_name)
543543
if existing_checkrun is None or not is_passing_status(
544544
existing_checkrun.status
@@ -653,7 +653,7 @@ def skip_func(idx: int, candidate: "GitHubPR") -> bool:
653653
if not open_only or not candidate.is_closed():
654654
return False
655655
print(
656-
f"Skipping {idx+1} of {len(rev_list)} PR (#{candidate.pr_num}) as its already been merged"
656+
f"Skipping {idx + 1} of {len(rev_list)} PR (#{candidate.pr_num}) as its already been merged"
657657
)
658658
return True
659659

.github/scripts/trymerge_explainer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def get_merge_message(
7777
(
7878
"<details><summary>Advanced Debugging</summary>",
7979
"Check the merge workflow status ",
80-
f"<a href=\"{os.getenv('GH_RUN_URL')}\">here</a>",
80+
f'<a href="{os.getenv("GH_RUN_URL")}">here</a>',
8181
"</details>",
8282
)
8383
)

.github/workflows/ruff_linter.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
- name: Install dependencies
6161
run: |
6262
python -m pip install --upgrade pip
63-
pip install ruff==0.6.8
63+
pip install ruff==0.11.6
6464
6565
- name: Regular lint check
6666
if: github.event_name != 'workflow_dispatch'

benchmarks/bench_galore_fused_kernels.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def run(args):
2121

2222
benchmark = get_benchmark(M, N, dtype, allow_tf32=allow_tf32)
2323
save_path = (
24-
f'benchmark_{M}x{N}_{rank}_{args.dtype}_{"tf32" if allow_tf32 else "no-tf32"}'
24+
f"benchmark_{M}x{N}_{rank}_{args.dtype}_{'tf32' if allow_tf32 else 'no-tf32'}"
2525
)
2626
if not os.path.exists(save_path):
2727
os.makedirs(save_path)

benchmarks/benchmark_low_bit_adam.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -185,12 +185,12 @@ def evaluate_model(model, args):
185185
if args.full_bf16:
186186
assert args.amp == "none", "When --full_bf16 is set, --amp must be none"
187187
if args.optim_cpu_offload == "deepspeed":
188-
assert (
189-
args.amp == "none"
190-
), "When using DeepSpeed ZeRO-Offload, --amp must be none"
191-
assert (
192-
args.optim == "AdamW"
193-
), "When using DeepSpeed ZeRO-Offload, --optim must be AdamW"
188+
assert args.amp == "none", (
189+
"When using DeepSpeed ZeRO-Offload, --amp must be none"
190+
)
191+
assert args.optim == "AdamW", (
192+
"When using DeepSpeed ZeRO-Offload, --optim must be AdamW"
193+
)
194194
if args.profile:
195195
args.n_epochs = 1
196196
if args.seed is not None:

benchmarks/benchmark_uintx.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def uintx_vs_fp16(nbits=[1, 2, 3, 4, 5, 6, 7], scales=[256, 512, 1024], repeats=
109109
for result in results:
110110
print(f"scale: {result[0]} fp16 time:{result[1]: .2f}ms speedups:")
111111
for i in range(2, len(result)):
112-
print(f"int{nbits[i-2]}: {result[1]/result[i]: .2f}x")
112+
print(f"int{nbits[i - 2]}: {result[1] / result[i]: .2f}x")
113113

114114

115115
if __name__ == "__main__":

benchmarks/float8/float8_roofline.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,9 @@ def run(
225225
* `enable_fusion_modeling`: if False uses Linear, if True uses LNLinearSigmoid and models the fusion of float8 overhead
226226
"""
227227

228-
assert not (
229-
(float8_recipe_name is not None) and (mx_recipe_name is not None)
230-
), "unsupported"
228+
assert not ((float8_recipe_name is not None) and (mx_recipe_name is not None)), (
229+
"unsupported"
230+
)
231231
if float8_recipe_name is None and mx_recipe_name is None:
232232
float8_recipe_name = "tensorwise"
233233

benchmarks/float8/profile_lowp_training.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -299,22 +299,21 @@ def main(
299299
"lowp",
300300
"ref",
301301
), "experiment_filter must be one of `both`, `lowp`, `ref`"
302-
assert (
303-
mode_filter
304-
in (
305-
"fwd_bwd",
306-
"fwd",
307-
"cast_only",
308-
"cast_with_to_blocked",
309-
"cast_only_dim0_dim1",
310-
)
311-
), "mode_filter must be one of `fwd_bwd`, `fwd`, `cast_only`, `cast_with_to_blocked`, `cast_only_dim0_dim1`"
302+
assert mode_filter in (
303+
"fwd_bwd",
304+
"fwd",
305+
"cast_only",
306+
"cast_with_to_blocked",
307+
"cast_only_dim0_dim1",
308+
), (
309+
"mode_filter must be one of `fwd_bwd`, `fwd`, `cast_only`, `cast_with_to_blocked`, `cast_only_dim0_dim1`"
310+
)
312311
if mode_filter == "cast_only":
313312
assert experiment_filter == "lowp", "unsupported"
314313

315-
assert not (
316-
float8_recipe_name is not None and mx_recipe_name is not None
317-
), "either float8_recipe_name or mx_recipe_name can be specified, but not both"
314+
assert not (float8_recipe_name is not None and mx_recipe_name is not None), (
315+
"either float8_recipe_name or mx_recipe_name can be specified, but not both"
316+
)
318317

319318
if float8_recipe_name is None and mx_recipe_name is None:
320319
config = Float8LinearConfig()

0 commit comments

Comments
 (0)