Skip to content

Commit ce5d440

Browse files
committed
chore(lint): drop ruff suppressions the code can satisfy
Drop unused parameters from private helpers and their callers, and mark the stub GithubException.headers as ClassVar. 中文:删除私有辅助函数及其调用处未使用的参数,并将桩 GithubException.headers 标注为 ClassVar。
1 parent ef6a4dc commit ce5d440

7 files changed

Lines changed: 11 additions & 16 deletions

File tree

‎inferencex-e2e/infx/bench_serving/benchmark_serving.py‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,6 @@ def calculate_metrics(
408408
outputs: list[RequestFuncOutput],
409409
dur_s: float,
410410
tokenizer: PreTrainedTokenizerBase,
411-
selected_percentile_metrics: list[str], # noqa: ARG001
412411
selected_percentiles: list[float],
413412
goodput_config_dict: dict[str, float],
414413
) -> tuple[BenchmarkMetrics, list[int]]:
@@ -678,7 +677,6 @@ async def limited_request_func(
678677
outputs=outputs,
679678
dur_s=benchmark_duration,
680679
tokenizer=tokenizer,
681-
selected_percentile_metrics=selected_percentile_metrics,
682680
selected_percentiles=selected_percentiles,
683681
goodput_config_dict=goodput_config_dict,
684682
)

‎inferencex-e2e/infx/datasets/proxy_to_weka.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def remap_hash(h: str, m: dict[str, int]) -> int:
135135
return m[h]
136136

137137

138-
def infer_block_size(rows: list[dict]) -> int: # noqa: ARG001
138+
def infer_block_size() -> int:
139139
"""Return the proxy's 64-token block size.
140140
141141
Partial trailing blocks make hash_token_count / len(hash_ids) unreliable.
@@ -331,7 +331,7 @@ def session_to_weka(session_id: str, rows: list[dict]) -> dict:
331331

332332
think_times = compute_think_times(rows)
333333
hash_map: dict[str, int] = {}
334-
block_size = infer_block_size(rows)
334+
block_size = infer_block_size()
335335

336336
out_requests: list[dict] = []
337337
instance_count: dict[str, int] = {}

‎inferencex-e2e/infx/evals/bfcl_adapter.py‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,6 @@ def _positive_int(value: str) -> int:
243243

244244

245245
def _source_details(
246-
suite: SuiteSpec, # noqa: ARG001
247246
case_ids_by_category: Mapping[str, tuple[str, ...]],
248247
) -> dict[str, Any]:
249248
"""Return the pinned upstream source metadata plus the case IDs selected per category."""
@@ -287,13 +286,12 @@ def _expected_category_details(
287286

288287

289288
def _diagnostics(
290-
suite: SuiteSpec,
291289
case_ids_by_category: Mapping[str, tuple[str, ...]],
292290
scores: Sequence[CategoryScore] | None = None,
293291
) -> dict[str, Any]:
294292
"""Return source metadata and per-category diagnostics, with placeholders if scores is None."""
295293
return {
296-
"source": _source_details(suite, case_ids_by_category),
294+
"source": _source_details(case_ids_by_category),
297295
"categories": (
298296
[score.as_dict() for score in scores]
299297
if scores is not None
@@ -334,7 +332,7 @@ def _native_report(
334332
"total_count": total_count,
335333
"expected_count": suite.expected_sample_count,
336334
},
337-
"bfcl": _diagnostics(suite, case_ids_by_category, scores),
335+
"bfcl": _diagnostics(case_ids_by_category, scores),
338336
}
339337
if integration_error is not None:
340338
report["integration_error"] = _error_dict(integration_error)
@@ -411,7 +409,7 @@ def _compatibility_result(
411409
"results": results,
412410
"configs": configs,
413411
"n-samples": task_samples,
414-
"bfcl": _diagnostics(suite, case_ids_by_category, scores),
412+
"bfcl": _diagnostics(case_ids_by_category, scores),
415413
}
416414
if integration_error is not None:
417415
result["integration_error"] = _error_dict(integration_error)

‎inferencex-e2e/infx/results/agentic/collect_sweep_results.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import pandas as pd
2323

2424

25-
def _load_custom_client_csv(client_csv: Path, exp_dir: Path) -> pd.DataFrame | None: # noqa: ARG001
25+
def _load_custom_client_csv(client_csv: Path) -> pd.DataFrame | None:
2626
"""Load per-request metrics from custom benchmark client CSV."""
2727
df = pd.read_csv(client_csv)
2828
if len(df) == 0:
@@ -144,7 +144,7 @@ def load_experiment(exp_dir: Path) -> dict | None:
144144
return result
145145
result.update(aiperf_metrics)
146146
elif client_csv.exists():
147-
df = _load_custom_client_csv(client_csv, exp_dir)
147+
df = _load_custom_client_csv(client_csv)
148148
if df is None or len(df) == 0:
149149
return result
150150

‎inferencex-e2e/infx/results/agentic/request_metrics.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,6 @@ def _aiperf_percent_metric_as_rate(
282282

283283

284284
def compute_cache_stats(
285-
records: list[dict[str, Any]], # noqa: ARG001
286285
aggregate: dict[str, Any],
287286
) -> tuple[dict[str, Any], dict[str, Any]]:
288287
"""Return flat and nested theoretical prefix cache hit rate from the aiperf ``aggregate``."""
@@ -311,7 +310,7 @@ def compute_request_metrics(
311310
qps_flat, qps_nested = compute_qps_stats(records)
312311
latency_flat, latency_nested = compute_latency_stats(records)
313312
workload_flat, workload_nested = compute_workload_stats(records, traces)
314-
cache_flat, cache_nested = compute_cache_stats(records, aggregate)
313+
cache_flat, cache_nested = compute_cache_stats(aggregate)
315314
throughput_flat, throughput_nested = compute_throughput_stats(records)
316315

317316
for part in (qps_flat, latency_flat, workload_flat, cache_flat, throughput_flat):

‎inferencex-e2e/infx/tests/bench_serving/test_benchmark_serving.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def test_metrics_retokenize_a_success_without_reported_usage():
142142
requests = [('p', 5, 4, None), ('p', 5, 7, None)]
143143

144144
metrics, output_lens = client.calculate_metrics(
145-
requests, outputs, 2.0, WordTokenizer(), ['tpot'], [50], {},
145+
requests, outputs, 2.0, WordTokenizer(), [50], {},
146146
)
147147

148148
assert output_lens == [4, 7]

‎inferencex-e2e/infx/workflows/merge_with_reuse.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
import sys
3131
import time
3232
from pathlib import Path
33-
from typing import TYPE_CHECKING
33+
from typing import TYPE_CHECKING, ClassVar
3434

3535
from infx.config import git_repository_root, project_root
3636

@@ -70,7 +70,7 @@ class GithubException(Exception): # type: ignore[no-redef] # noqa: N818
7070

7171
status = 0
7272
data: object = None
73-
headers: dict = {} # type: ignore[type-arg] # noqa: RUF012
73+
headers: ClassVar[dict] = {} # type: ignore[type-arg]
7474

7575
class RateLimitExceededException(GithubException): # type: ignore[no-redef]
7676
"""Stub when PyGithub is not installed."""

0 commit comments

Comments
 (0)