Apply several ruff SIM rules (#37283)

* Apply ruff SIM118 fix

Signed-off-by: cyy <cyyever@outlook.com>

* Apply ruff SIM910 fix

Signed-off-by: cyy <cyyever@outlook.com>

* Apply ruff SIM101 fix

Signed-off-by: cyy <cyyever@outlook.com>

* Format code

Signed-off-by: cyy <cyyever@outlook.com>

* More fixes

Signed-off-by: cyy <cyyever@outlook.com>

---------

Signed-off-by: cyy <cyyever@outlook.com>
This commit is contained in:
Yuanyuan Chen
2025-07-29 19:40:34 +08:00
committed by GitHub
parent cf97f6cfd1
commit 95faabf0a6
391 changed files with 762 additions and 788 deletions

View File

@@ -568,7 +568,7 @@ class PipelineUtilsTest(unittest.TestCase):
from transformers.pipelines import SUPPORTED_TASKS
set_seed_fn = lambda: torch.manual_seed(0) # noqa: E731
for task in SUPPORTED_TASKS.keys():
for task in SUPPORTED_TASKS:
if task == "table-question-answering":
# test table in separate test due to more dependencies
continue
@@ -627,7 +627,7 @@ class PipelineUtilsTest(unittest.TestCase):
model_ids = []
revisions = []
tasks = []
for translation_pair in task_dict["default"].keys():
for translation_pair in task_dict["default"]:
model_id, revision = task_dict["default"][translation_pair]["model"][framework]
model_ids.append(model_id)