Skip to content

Official Codebase of 3DCodeVerse

Python

bench/time_audit: ruff

gaoypeng64fe62636141
diff --git a/harness/bench/time_audit/calls.py b/harness/bench/time_audit/calls.py
index fb4266e3..8adaf6b5 100644
--- a/harness/bench/time_audit/calls.py
+++ b/harness/bench/time_audit/calls.py
@@ -7,7 +7,6 @@ import re
import sys
from collections import Counter, defaultdict
from pathlib import Path
-from typing import Any
sys.path.insert(0, str(Path(__file__).parent))
from corpus import RunRef, cost_rows, discover, fmt, med_p90, trajectories # noqa: E402
diff --git a/harness/bench/time_audit/keys.py b/harness/bench/time_audit/keys.py
index 6600a19e..64cc9f10 100644
--- a/harness/bench/time_audit/keys.py
+++ b/harness/bench/time_audit/keys.py
@@ -11,6 +11,8 @@ from collections import Counter
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent))
+import contextlib
+
from corpus import discover, read_jsonl # noqa: E402
KEYLIKE = re.compile(r"key|api_key|credential", re.I)
@@ -44,10 +46,8 @@ def main() -> None:
for row in read_jsonl(p):
walk(row, p.name, found)
else:
- try:
+ with contextlib.suppress(json.JSONDecodeError):
walk(json.loads(text), p.name, found)
- except json.JSONDecodeError:
- pass
print(f"scanned {files} files; '\"key\": \"…xxxx\"' occurrences: {redacted}")
print("key-like field names found (name -> count):")
for k, v in found.most_common(20):
diff --git a/harness/bench/time_audit/stage_times.py b/harness/bench/time_audit/stage_times.py
index 5349c1b1..3176f630 100644
--- a/harness/bench/time_audit/stage_times.py
+++ b/harness/bench/time_audit/stage_times.py
@@ -91,7 +91,7 @@ def analyse(ref: RunRef) -> dict[str, Any]:
build.append(b)
gates.append(s["gates_t"] - s["last_build"])
r = rd.get(s["round"], {})
- rnd = float(((r.get("renders") or {}).get("duration_ms") or 0)) / 1000
+ rnd = float((r.get("renders") or {}).get("duration_ms") or 0) / 1000
render.append(rnd)
j = s.get("judge_s", 0.0)
judge.append(j)
diff --git a/harness/bench/time_audit/storm_attempts.py b/harness/bench/time_audit/storm_attempts.py
index a8c1158b..601d947a 100644
--- a/harness/bench/time_audit/storm_attempts.py
+++ b/harness/bench/time_audit/storm_attempts.py
@@ -10,7 +10,7 @@ from collections import Counter
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent))
-from corpus import RunRef, discover, fmt, med_p90, trajectories # noqa: E402
+from corpus import discover, fmt, med_p90, trajectories # noqa: E402
from turns import parse_turns # noqa: E402
STORM_RE = re.compile(r"gemini (\S+) capacity storm (\d+)/60 .*; waiting (\d+)s")