Skip to content

Commit ef6a4dc

Browse files
committed
chore(lint): drop ruff suppressions the code can satisfy
Use bare return in redirect handlers, contextlib.suppress for silent fallbacks, and top-level imports in merge_with_reuse. 中文:重定向处理器改用裸 return,静默回退改用 contextlib.suppress,merge_with_reuse 的导入移到文件顶部。
1 parent ee30dc8 commit ef6a4dc

5 files changed

Lines changed: 19 additions & 22 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class FullSuiteError(RuntimeError):
5959
class _RejectRedirects(urllib.request.HTTPRedirectHandler):
6060
def redirect_request(self, *args: Any, **kwargs: Any) -> None: # noqa: ARG002
6161
"""Refuse every redirect by returning None."""
62-
return None # noqa: RET501
62+
return
6363

6464

6565
_NO_REDIRECT_OPENER = urllib.request.build_opener(_RejectRedirects())

‎inferencex-e2e/infx/klaud/api.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def redirect_request(
5454
newurl: str, # noqa: ARG002
5555
) -> None:
5656
"""Refuse every redirect by returning None."""
57-
return None # noqa: RET501
57+
return
5858

5959

6060
def reject_nonfinite(value: str) -> Never: # noqa: ARG001

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
python collect_sweep_results.py <artifacts_dir> <output_dir>
1515
"""
1616

17+
import contextlib
1718
import json
1819
import sys
1920
from pathlib import Path
@@ -150,12 +151,8 @@ def load_experiment(exp_dir: Path) -> dict | None:
150151
metadata_file = exp_dir / "benchmark_metadata.json"
151152
total_time_sec = None
152153
if metadata_file.exists():
153-
try:
154-
with open(metadata_file) as f:
155-
metadata = json.load(f)
156-
total_time_sec = metadata.get("benchmark_runtime_sec")
157-
except Exception: # noqa: BLE001, S110
158-
pass
154+
with contextlib.suppress(Exception), open(metadata_file) as f:
155+
total_time_sec = json.load(f).get("benchmark_runtime_sec")
159156

160157
if not total_time_sec or total_time_sec <= 0:
161158
first_start_ms = df["start_time_ms"].min()

‎inferencex-e2e/infx/results/collect_eval_results.py‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import contextlib
12
import json
23
import sys
34
from pathlib import Path
@@ -59,14 +60,12 @@ def find_eval_sets(root: Path) -> list[Path]:
5960
extracted flat into root (no subdirectory), so check root itself too.
6061
"""
6162
out: list[Path] = []
62-
try:
63+
with contextlib.suppress(Exception):
6364
if (root / "meta_env.json").exists():
6465
out.append(root)
6566
out.extend(
6667
d for d in sorted(root.iterdir()) if d.is_dir() and (d / "meta_env.json").exists()
6768
)
68-
except Exception: # noqa: BLE001, S110
69-
pass
7069
return out
7170

7271

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

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,18 @@
3434

3535
from infx.config import git_repository_root, project_root
3636

37+
from .prepare_perf_changelog_merge import (
38+
canonicalize_appended_links,
39+
resolve_conflict_bytes,
40+
)
41+
from .sweep_runs import (
42+
artifact_names,
43+
completed_pr_runs,
44+
has_reusable_result_artifacts,
45+
pr_commit_shas,
46+
)
47+
from .validate_perf_changelog import read_git_file
48+
3749
try:
3850
import git as gitpython
3951
import requests
@@ -70,17 +82,6 @@ class RateLimitExceededException(GithubException): # type: ignore[no-redef]
7082
from github.PullRequest import PullRequest
7183
from github.Repository import Repository
7284

73-
from .prepare_perf_changelog_merge import ( # noqa: E402
74-
canonicalize_appended_links,
75-
resolve_conflict_bytes,
76-
)
77-
from .sweep_runs import ( # noqa: E402
78-
artifact_names,
79-
completed_pr_runs,
80-
has_reusable_result_artifacts,
81-
pr_commit_shas,
82-
)
83-
from .validate_perf_changelog import read_git_file # noqa: E402
8485

8586
DEFAULT_REPO = "SemiAnalysisAI/InferenceX"
8687
DEFAULT_CHECK_TIMEOUT = 900

0 commit comments

Comments
 (0)