[BE]: Update ruff to 0.285 (#107519)

This updates ruff to 0.285 which is faster, better, and have fixes a bunch of false negatives with regards to fstrings.

I also enabled RUF017 which looks for accidental quadratic list summation. Luckily, seems like there are no instances of it in our codebase, so enabling it so that it stays like that. :)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/107519
Approved by: https://github.com/ezyang
This commit is contained in:
Aaron Gokaslan
2023-08-22 23:16:35 +00:00
committed by PyTorch MergeBot
parent e8278d6058
commit 660e8060ad
86 changed files with 319 additions and 403 deletions

View File

@ -152,10 +152,10 @@ class TestDispatch(TestCase):
# NB: this finally test asserts that if a registrations fails,
# the dispatcher is left in the same state *that it was before*!
check_invariants(
"running ctors {} and then failing to run ctor {} "
f"running ctors {ctor_order[:i]} and then failing to run ctor {op_ix} "
"(did this failure leave the dispatcher in a wedged state? "
"it shouldn't!)"
.format(ctor_order[:i], op_ix))
)
break
last_ctor = i
if expect_raises and len(active_ops) == len(ops):
@ -165,7 +165,7 @@ class TestDispatch(TestCase):
self.assertTrue(
False,
"expected exception to be raised, but nothing was raised "
"(after running ctors {})".format(ctor_order))
f"(after running ctors {ctor_order})")
# In the order specified by dtor_order, run deregistrations
for i, op_ix in enumerate(dtor_order):
# Trigger a destruction