mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
[BE][CI] bump ruff
to 0.8.4 (#143753)
Changes: 1. Bump `ruff` from 0.7.4 to 0.8.4 2. Change `%`-formatted strings to f-string 3. Change arguments with the `__`-prefix to positional-only arguments with the `/` separator in function signature. Pull Request resolved: https://github.com/pytorch/pytorch/pull/143753 Approved by: https://github.com/Skylion007
This commit is contained in:
committed by
PyTorch MergeBot
parent
dbbc81cb34
commit
b77406a9ec
@ -30,13 +30,13 @@ def _test_success_single_arg_func(i, arg):
|
||||
|
||||
def _test_exception_single_func(i, arg):
|
||||
if i == arg:
|
||||
raise ValueError("legitimate exception from process %d" % i)
|
||||
raise ValueError(f"legitimate exception from process {i:d}")
|
||||
time.sleep(1.0)
|
||||
|
||||
|
||||
def _test_exception_all_func(i):
|
||||
time.sleep(random.random() / 10)
|
||||
raise ValueError("legitimate exception from process %d" % i)
|
||||
raise ValueError(f"legitimate exception from process {i:d}")
|
||||
|
||||
|
||||
def _test_terminate_signal_func(i):
|
||||
@ -120,7 +120,7 @@ class _TestMultiProcessing:
|
||||
for i in range(nprocs):
|
||||
with self.assertRaisesRegex(
|
||||
Exception,
|
||||
"\nValueError: legitimate exception from process %d$" % i,
|
||||
f"\nValueError: legitimate exception from process {i:d}$",
|
||||
):
|
||||
mp.start_processes(_test_exception_single_func, args=(i,), nprocs=nprocs, start_method=self.start_method)
|
||||
|
||||
@ -153,13 +153,13 @@ class _TestMultiProcessing:
|
||||
pid1 = ctx.processes[1].pid
|
||||
with self.assertRaisesRegex(
|
||||
Exception,
|
||||
"process 0 terminated with exit code %d" % exitcode,
|
||||
f"process 0 terminated with exit code {exitcode:d}",
|
||||
), self.assertLogs(level='WARNING') as logs:
|
||||
while not ctx.join(grace_period=grace_period):
|
||||
pass
|
||||
if grace_period is None:
|
||||
# pid1 is killed by signal.
|
||||
expected_log = "Terminating process %d via signal" % pid1
|
||||
expected_log = f"Terminating process {pid1:d} via signal"
|
||||
self.assertIn(expected_log, logs.records[0].getMessage())
|
||||
else:
|
||||
# pid1 exits on its own.
|
||||
|
Reference in New Issue
Block a user