mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-23 14:59:34 +08:00
[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:
committed by
PyTorch MergeBot
parent
02c2b750c5
commit
88ab3e4322
@ -315,7 +315,7 @@ class DataLoader(Generic[T_co]):
|
||||
# See NOTE [ Custom Samplers and IterableDataset ]
|
||||
raise ValueError(
|
||||
"DataLoader with IterableDataset: expected unspecified "
|
||||
"batch_sampler option, but got batch_sampler={}".format(batch_sampler))
|
||||
f"batch_sampler option, but got batch_sampler={batch_sampler}")
|
||||
else:
|
||||
shuffle = bool(shuffle)
|
||||
self._dataset_kind = _DatasetKind.Map
|
||||
@ -397,19 +397,19 @@ class DataLoader(Generic[T_co]):
|
||||
valid_start_methods = multiprocessing.get_all_start_methods()
|
||||
if multiprocessing_context not in valid_start_methods:
|
||||
raise ValueError(
|
||||
('multiprocessing_context option '
|
||||
'should specify a valid start method in {!r}, but got '
|
||||
'multiprocessing_context={!r}').format(valid_start_methods, multiprocessing_context))
|
||||
'multiprocessing_context option '
|
||||
f'should specify a valid start method in {valid_start_methods!r}, but got '
|
||||
f'multiprocessing_context={multiprocessing_context!r}')
|
||||
multiprocessing_context = multiprocessing.get_context(multiprocessing_context)
|
||||
|
||||
if not isinstance(multiprocessing_context, python_multiprocessing.context.BaseContext):
|
||||
raise TypeError(('multiprocessing_context option should be a valid context '
|
||||
'object or a string specifying the start method, but got '
|
||||
'multiprocessing_context={}').format(multiprocessing_context))
|
||||
raise TypeError('multiprocessing_context option should be a valid context '
|
||||
'object or a string specifying the start method, but got '
|
||||
f'multiprocessing_context={multiprocessing_context}')
|
||||
else:
|
||||
raise ValueError(('multiprocessing_context can only be used with '
|
||||
'multi-process loading (num_workers > 0), but got '
|
||||
'num_workers={}').format(self.num_workers))
|
||||
raise ValueError('multiprocessing_context can only be used with '
|
||||
'multi-process loading (num_workers > 0), but got '
|
||||
f'num_workers={self.num_workers}')
|
||||
|
||||
self.__multiprocessing_context = multiprocessing_context
|
||||
|
||||
|
Reference in New Issue
Block a user