[BE][CI] bump ruff to 0.9.2: multiline assert statements (#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: https://github.com/pytorch/pytorch/pull/144546
Approved by: https://github.com/malfet
This commit is contained in:
Xuehai Pan
2025-02-27 22:43:26 +08:00
committed by PyTorch MergeBot
parent f0d00421cf
commit c73a92fbf5
84 changed files with 634 additions and 622 deletions

View File

@ -616,9 +616,9 @@ def load_deprecated_signatures(
}
schema_args_by_name = {a.name: a for a in schema.arguments.flat_all}
for name in call_args:
assert (
name in schema_args_by_name or name in known_constants
), f"deprecation definiton: Unrecognized value {name}"
assert name in schema_args_by_name or name in known_constants, (
f"deprecation definiton: Unrecognized value {name}"
)
# Map deprecated signature arguments to their aten signature and test
# if the types and alias annotation match.
@ -683,7 +683,9 @@ def load_deprecated_signatures(
function=pair.function,
)
)
assert any_schema_found, f"No native function with name {aten_name} matched signature:\n {str(schema)}"
assert any_schema_found, (
f"No native function with name {aten_name} matched signature:\n {str(schema)}"
)
return results