From b1225b67ff1ac0dfcabbf15c0a6eae517b3103c2 Mon Sep 17 00:00:00 2001 From: loyce-cheng <129246079+loyce-cheng@users.noreply.github.com> Date: Sat, 3 Oct 2026 20:44:41 +0800 Subject: [PATCH] chore(perf): enforce F401 and remove unused imports --- evalscope/perf/core/metrics_consumer.py | 2 +- evalscope/perf/core/strategies/multi_turn.py | 4 ++-- evalscope/perf/plugin/api/custom_api.py | 2 +- evalscope/perf/plugin/api/dashscope_api.py | 2 +- evalscope/perf/plugin/api/openai_embedding_api.py | 2 +- evalscope/perf/plugin/api/openai_rerank_api.py | 2 +- evalscope/perf/plugin/datasets/base.py | 2 +- evalscope/perf/plugin/datasets/custom.py | 2 +- evalscope/perf/plugin/datasets/flickr8k.py | 2 +- evalscope/perf/plugin/datasets/kontext_bench.py | 2 +- evalscope/perf/plugin/datasets/line_by_line.py | 1 - evalscope/perf/plugin/datasets/longalpaca.py | 2 +- evalscope/perf/plugin/datasets/multi_turn.py | 2 +- evalscope/perf/plugin/datasets/openqa.py | 2 +- evalscope/perf/plugin/datasets/rerank_dataset.py | 2 +- evalscope/perf/plugin/datasets/speed_benchmark.py | 2 +- evalscope/perf/plugin/datasets/swe_smith.py | 4 ++-- evalscope/perf/plugin/registry.py | 2 +- evalscope/perf/utils/perf_models.py | 1 - evalscope/perf/utils/report/generate_report.py | 3 +-- pyproject.toml | 2 +- 21 files changed, 21 insertions(+), 24 deletions(-) diff --git a/evalscope/perf/core/metrics_consumer.py b/evalscope/perf/core/metrics_consumer.py index 6844d2383..62fdedaf0 100644 --- a/evalscope/perf/core/metrics_consumer.py +++ b/evalscope/perf/core/metrics_consumer.py @@ -7,7 +7,7 @@ from evalscope.constants import HEARTBEAT_INTERVAL_SEC from evalscope.perf.arguments import Arguments -from evalscope.perf.core.http_client import AioHttpClient, test_connection +from evalscope.perf.core.http_client import test_connection from evalscope.perf.utils.benchmark_util import Metrics, MetricsAccumulator from evalscope.perf.utils.db_util import create_result_table, get_result_db_path, insert_benchmark_data from evalscope.perf.utils.handler import exception_handler diff --git a/evalscope/perf/core/strategies/multi_turn.py b/evalscope/perf/core/strategies/multi_turn.py index a8203c9a3..b865f9e6c 100644 --- a/evalscope/perf/core/strategies/multi_turn.py +++ b/evalscope/perf/core/strategies/multi_turn.py @@ -1,12 +1,12 @@ import asyncio import time -from typing import TYPE_CHECKING, Any, Dict, List, Optional +from typing import TYPE_CHECKING, List, Optional import numpy as np from evalscope.perf.arguments import Arguments from evalscope.perf.core.strategies.base import BenchmarkStrategy -from evalscope.perf.plugin.datasets.base import Conversation, Message, Turn +from evalscope.perf.plugin.datasets.base import Conversation, Message from evalscope.utils.logger import get_logger if TYPE_CHECKING: diff --git a/evalscope/perf/plugin/api/custom_api.py b/evalscope/perf/plugin/api/custom_api.py index 732a6627a..fe3481ac0 100644 --- a/evalscope/perf/plugin/api/custom_api.py +++ b/evalscope/perf/plugin/api/custom_api.py @@ -1,5 +1,5 @@ import json -from typing import Any, AsyncGenerator, Dict, List, Tuple, Union +from typing import Dict, List, Tuple, Union import aiohttp diff --git a/evalscope/perf/plugin/api/dashscope_api.py b/evalscope/perf/plugin/api/dashscope_api.py index 91a73e834..d5616c41e 100644 --- a/evalscope/perf/plugin/api/dashscope_api.py +++ b/evalscope/perf/plugin/api/dashscope_api.py @@ -1,6 +1,6 @@ import json import os -from typing import Any, Dict, Iterator, List +from typing import Dict, List from evalscope.perf.arguments import Arguments from evalscope.perf.multi_turn_args import _sample_int_or_range diff --git a/evalscope/perf/plugin/api/openai_embedding_api.py b/evalscope/perf/plugin/api/openai_embedding_api.py index 990feb036..fea63a773 100644 --- a/evalscope/perf/plugin/api/openai_embedding_api.py +++ b/evalscope/perf/plugin/api/openai_embedding_api.py @@ -4,7 +4,7 @@ import sys import time import traceback -from typing import Any, Dict, List, Tuple, Union +from typing import Dict, List, Tuple, Union from evalscope.perf.arguments import Arguments from evalscope.perf.plugin.api.base import ApiPluginBase diff --git a/evalscope/perf/plugin/api/openai_rerank_api.py b/evalscope/perf/plugin/api/openai_rerank_api.py index de2c39c2e..d1c2ff3e7 100644 --- a/evalscope/perf/plugin/api/openai_rerank_api.py +++ b/evalscope/perf/plugin/api/openai_rerank_api.py @@ -4,7 +4,7 @@ import sys import time import traceback -from typing import Any, Dict, List, Tuple, Union +from typing import Dict, List, Tuple, Union from evalscope.perf.arguments import Arguments from evalscope.perf.plugin.api.base import ApiPluginBase diff --git a/evalscope/perf/plugin/datasets/base.py b/evalscope/perf/plugin/datasets/base.py index 494cb2498..3e103b563 100644 --- a/evalscope/perf/plugin/datasets/base.py +++ b/evalscope/perf/plugin/datasets/base.py @@ -1,7 +1,7 @@ import json import os from abc import abstractmethod -from dataclasses import dataclass, field +from dataclasses import dataclass from typing import Any, ClassVar, Dict, Iterator, List, Optional, Tuple, Type, Union from evalscope.api.dataset.hub import download_dataset_file, load_dataset_from_hub diff --git a/evalscope/perf/plugin/datasets/custom.py b/evalscope/perf/plugin/datasets/custom.py index c773d052b..d7efdc034 100644 --- a/evalscope/perf/plugin/datasets/custom.py +++ b/evalscope/perf/plugin/datasets/custom.py @@ -1,5 +1,5 @@ import json -from typing import Any, Dict, Iterator, List +from typing import Dict, Iterator, List from evalscope.perf.arguments import Arguments from evalscope.perf.plugin.datasets.base import Conversation, DatasetPluginBase, Message, Messages, Turn diff --git a/evalscope/perf/plugin/datasets/flickr8k.py b/evalscope/perf/plugin/datasets/flickr8k.py index 8178e0195..1a3c66a49 100644 --- a/evalscope/perf/plugin/datasets/flickr8k.py +++ b/evalscope/perf/plugin/datasets/flickr8k.py @@ -1,4 +1,4 @@ -from typing import Any, Dict, Iterator, List +from typing import Dict, Iterator, List from evalscope.perf.arguments import Arguments from evalscope.perf.plugin.datasets.base import DatasetPluginBase diff --git a/evalscope/perf/plugin/datasets/kontext_bench.py b/evalscope/perf/plugin/datasets/kontext_bench.py index 1c9a8bc6d..3e20341b2 100644 --- a/evalscope/perf/plugin/datasets/kontext_bench.py +++ b/evalscope/perf/plugin/datasets/kontext_bench.py @@ -1,4 +1,4 @@ -from typing import Any, Dict, Iterator, List +from typing import Dict, Iterator, List from evalscope.perf.arguments import Arguments from evalscope.perf.plugin.datasets.base import DatasetPluginBase diff --git a/evalscope/perf/plugin/datasets/line_by_line.py b/evalscope/perf/plugin/datasets/line_by_line.py index f38eb5d15..c0951ffde 100644 --- a/evalscope/perf/plugin/datasets/line_by_line.py +++ b/evalscope/perf/plugin/datasets/line_by_line.py @@ -1,5 +1,4 @@ import json -import sys from typing import Any, Dict, Iterator, List, Union from evalscope.perf.arguments import Arguments diff --git a/evalscope/perf/plugin/datasets/longalpaca.py b/evalscope/perf/plugin/datasets/longalpaca.py index c1a82f0ec..6b59b6374 100644 --- a/evalscope/perf/plugin/datasets/longalpaca.py +++ b/evalscope/perf/plugin/datasets/longalpaca.py @@ -1,5 +1,5 @@ import os -from typing import Any, Dict, Iterator, List +from typing import Dict, Iterator, List from evalscope.perf.arguments import Arguments from evalscope.perf.plugin.datasets.base import DatasetPluginBase diff --git a/evalscope/perf/plugin/datasets/multi_turn.py b/evalscope/perf/plugin/datasets/multi_turn.py index e3cb73467..99e07038a 100644 --- a/evalscope/perf/plugin/datasets/multi_turn.py +++ b/evalscope/perf/plugin/datasets/multi_turn.py @@ -31,7 +31,7 @@ import json import os -from typing import Any, Dict, Iterator, List +from typing import Dict, Iterator, List import numpy as np diff --git a/evalscope/perf/plugin/datasets/openqa.py b/evalscope/perf/plugin/datasets/openqa.py index aba959ad2..cc76e355e 100644 --- a/evalscope/perf/plugin/datasets/openqa.py +++ b/evalscope/perf/plugin/datasets/openqa.py @@ -1,6 +1,6 @@ import json import os -from typing import Any, Dict, Iterator, List +from typing import Dict, Iterator, List from evalscope.perf.arguments import Arguments from evalscope.perf.plugin.datasets.base import DatasetPluginBase diff --git a/evalscope/perf/plugin/datasets/rerank_dataset.py b/evalscope/perf/plugin/datasets/rerank_dataset.py index 5cc9d7121..d305aae8e 100644 --- a/evalscope/perf/plugin/datasets/rerank_dataset.py +++ b/evalscope/perf/plugin/datasets/rerank_dataset.py @@ -5,7 +5,7 @@ import json import os -from typing import Dict, Iterator, List +from typing import Dict, Iterator import numpy as np diff --git a/evalscope/perf/plugin/datasets/speed_benchmark.py b/evalscope/perf/plugin/datasets/speed_benchmark.py index bf9ed1611..e6b143c07 100644 --- a/evalscope/perf/plugin/datasets/speed_benchmark.py +++ b/evalscope/perf/plugin/datasets/speed_benchmark.py @@ -1,4 +1,4 @@ -from typing import Dict, Iterator, List, Tuple +from typing import Dict, Iterator, List from evalscope.perf.arguments import Arguments from evalscope.perf.plugin.datasets.base import DatasetPluginBase diff --git a/evalscope/perf/plugin/datasets/swe_smith.py b/evalscope/perf/plugin/datasets/swe_smith.py index e72023306..a070271c9 100644 --- a/evalscope/perf/plugin/datasets/swe_smith.py +++ b/evalscope/perf/plugin/datasets/swe_smith.py @@ -23,14 +23,14 @@ import json import multiprocessing -from typing import Any, Dict, Iterator, List, Optional, Tuple +from typing import Dict, Iterator, List, Optional, Tuple import numpy as np from tqdm import tqdm from evalscope.perf.arguments import Arguments from evalscope.perf.multi_turn_args import _get_range_upper -from evalscope.perf.plugin.datasets.base import Conversation, DatasetPluginBase, Message, Messages, Turn +from evalscope.perf.plugin.datasets.base import Conversation, DatasetPluginBase, Messages, Turn from evalscope.perf.plugin.datasets.dataset_args import MultiTurnDatasetArgs from evalscope.perf.plugin.datasets.utils import tokenize_chat_messages, truncate_text_to_token_len from evalscope.perf.plugin.registry import register_dataset diff --git a/evalscope/perf/plugin/registry.py b/evalscope/perf/plugin/registry.py index e3a25a9a7..a1ff017ae 100644 --- a/evalscope/perf/plugin/registry.py +++ b/evalscope/perf/plugin/registry.py @@ -1,4 +1,4 @@ -from typing import TYPE_CHECKING, Any, List, Type, Union +from typing import TYPE_CHECKING, List, Type, Union if TYPE_CHECKING: from .api import ApiPluginBase diff --git a/evalscope/perf/utils/perf_models.py b/evalscope/perf/utils/perf_models.py index 63707d78a..8df27ddc5 100644 --- a/evalscope/perf/utils/perf_models.py +++ b/evalscope/perf/utils/perf_models.py @@ -15,7 +15,6 @@ from __future__ import annotations -import json from typing import Any, Dict, List, Optional from pydantic import BaseModel, ConfigDict, Field, field_validator diff --git a/evalscope/perf/utils/report/generate_report.py b/evalscope/perf/utils/report/generate_report.py index e4291ffcf..9c87cfb2a 100644 --- a/evalscope/perf/utils/report/generate_report.py +++ b/evalscope/perf/utils/report/generate_report.py @@ -12,8 +12,7 @@ from __future__ import annotations import os -from collections import OrderedDict -from typing import Any, Dict, List, Optional +from typing import Any, Dict from evalscope.constants import DEFAULT_LANGUAGE, PLOTLY_CDN_URL from evalscope.utils.io_utils import current_time diff --git a/pyproject.toml b/pyproject.toml index a3d86909d..751a7acb6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -129,7 +129,7 @@ ignore = ["E501"] [tool.ruff.lint.per-file-ignores] "tests/**/*.py" = ["E402"] "__init__.py" = ["F401"] -"!evalscope/{utils,cli,report}/**/*.py" = ["F401"] +"!evalscope/{utils,cli,report,perf}/**/*.py" = ["F401"] [tool.ruff.format] exclude = ["tests/**/*.py"]