Skip to content

Official Codebase of 3DCodeVerse

Python

cleanup: A1 — Delete nine dead public defs

gaoypengc8330005cf36
diff --git a/harness/bench/report.py b/harness/bench/report.py
index 5e3f59b7..bb7bef6c 100644
--- a/harness/bench/report.py
+++ b/harness/bench/report.py
@@ -12,7 +12,6 @@ import html
import json
import statistics
from pathlib import Path
-from typing import Any
from pydantic import BaseModel, Field
@@ -178,7 +177,3 @@ def _html_gallery(out: Path, name: str, results: list[BenchItemResult], rep: Ben
+ "<h3>by category</h3>" + _html_table(rep.by_category))
items = [_item_for(r) for r in results]
return render_gallery(items, f"bench — {name}", extra_html=tables)
-
-
-def report_dict(rep: BenchReport) -> dict[str, Any]:
- return rep.model_dump(mode="json", exclude={"markdown", "html"})
diff --git a/harness/bench/run_bench.py b/harness/bench/run_bench.py
index 2fdcd8c6..b3de5733 100644
--- a/harness/bench/run_bench.py
+++ b/harness/bench/run_bench.py
@@ -159,11 +159,6 @@ def select_prompts(
return items[:limit] if limit is not None else items
-def _select(battery: Battery, opts: BenchOptions) -> list[BenchPrompt]:
- """Deprecated: use :func:`select_prompts`."""
- return select_prompts(battery, ids=opts.ids, tiers=opts.tiers, limit=opts.limit)
-
-
RunFn = Callable[[Spec, Workspace, bool], RunRecord]
@@ -174,10 +169,6 @@ def default_run_track(spec: Spec, ws: Workspace, resume: bool) -> RunRecord:
return get_track(spec.track).run(spec, ws, resume=resume)
-#: deprecated alias — use :func:`default_run_track`
-_default_run = default_run_track
-
-
def run_battery(
battery_path: Path | str, out_dir: Path | str, opts: BenchOptions | None = None, *,
run_fn: RunFn | None = None, on_result: Callable[[BenchItemResult], None] | None = None,
diff --git a/harness/codeverse/cli/_common.py b/harness/codeverse/cli/_common.py
index ff02f38a..ee8dce00 100644
--- a/harness/codeverse/cli/_common.py
+++ b/harness/codeverse/cli/_common.py
@@ -13,7 +13,7 @@ from typing import Any
import typer
-from codeverse.cli._fmt import console, err
+from codeverse.cli._fmt import err
from codeverse.config import get_settings
from codeverse.contracts.spec import Spec
from codeverse.conventions import slugify
@@ -118,12 +118,6 @@ def parse_kv_floats(items: list[str], flag: str) -> dict[str, float]:
return out
-def echo_json(obj: Any) -> None:
- import json
-
- console.print_json(json.dumps(obj, default=str, ensure_ascii=False))
-
-
# --------------------------------------------------------------------------- cost profile
def active_profile(settings: Any | None = None) -> Any:
"""The :class:`~codeverse.cost.profiles.Profile` the current settings name."""
diff --git a/harness/codeverse/flywheel/gallery.py b/harness/codeverse/flywheel/gallery.py
index 2c6affb2..03a8317c 100644
--- a/harness/codeverse/flywheel/gallery.py
+++ b/harness/codeverse/flywheel/gallery.py
@@ -15,7 +15,6 @@ import html
import io
import statistics
from pathlib import Path
-from typing import Any
from pydantic import BaseModel, Field
@@ -234,7 +233,3 @@ def write_gallery(runs_dir: Path | str, out_html: Path | str, *, title: str | No
out.parent.mkdir(parents=True, exist_ok=True)
out.write_text(render_gallery(items, title or f"3dcv gallery — {Path(runs_dir).name}", thumb_px=thumb_px))
return out, len(items)
-
-
-def gallery_dict(items: list[GalleryItem]) -> list[dict[str, Any]]:
- return [i.model_dump(mode="json") for i in items]
diff --git a/harness/codeverse/gallery/labels.py b/harness/codeverse/gallery/labels.py
index 0af72d85..a0f4dd0e 100644
--- a/harness/codeverse/gallery/labels.py
+++ b/harness/codeverse/gallery/labels.py
@@ -77,15 +77,3 @@ def humanize_view(name: str) -> str:
if low.startswith("frame_"):
return f"Frame {stem[6:]}"
return " ".join(_word(t) for t in stem.split("_") if t) or stem
-
-
-def verdict_label(verdict: str) -> str:
- return VERDICT_META.get(verdict, (verdict, "", ""))[0]
-
-
-def verdict_class(verdict: str) -> str:
- return VERDICT_META.get(verdict, ("", "", ""))[1]
-
-
-def verdict_title(verdict: str) -> str:
- return VERDICT_META.get(verdict, ("", "", ""))[2]
diff --git a/harness/codeverse/gallery/paths.py b/harness/codeverse/gallery/paths.py
index dfdc7f13..95c7d782 100644
--- a/harness/codeverse/gallery/paths.py
+++ b/harness/codeverse/gallery/paths.py
@@ -41,12 +41,3 @@ def safe_join(root: Path | str, rel: str) -> Path:
if resolved != base and base not in resolved.parents:
raise PathError(f"path escapes the run directory: {rel!r}")
return resolved
-
-
-def is_inside(root: Path | str, path: Path | str) -> bool:
- """True when ``path`` resolves inside ``root`` (used for the declared roots)."""
- try:
- base, p = Path(root).resolve(), Path(path).resolve()
- except OSError:
- return False
- return p == base or base in p.parents
diff --git a/harness/codeverse/gallery/server.py b/harness/codeverse/gallery/server.py
index d83c51f1..382fa5bb 100644
--- a/harness/codeverse/gallery/server.py
+++ b/harness/codeverse/gallery/server.py
@@ -20,7 +20,6 @@ from __future__ import annotations
import contextlib
import json
import os
-import socket
import threading
from dataclasses import dataclass, field
from datetime import UTC, datetime
@@ -380,12 +379,5 @@ def _open(url: str) -> None:
webbrowser.open(url)
-def free_port(host: str = DEFAULT_HOST) -> int:
- """An ephemeral free port (tests, and ``--port 0``)."""
- with socket.socket() as s:
- s.bind((host, 0))
- return int(s.getsockname()[1])
-
-
def started_at() -> str:
return datetime.now(UTC).isoformat(timespec="seconds")
diff --git a/harness/codeverse/judges/images.py b/harness/codeverse/judges/images.py
index e92747b5..564b51b4 100644
--- a/harness/codeverse/judges/images.py
+++ b/harness/codeverse/judges/images.py
@@ -52,19 +52,6 @@ def view_az_el(view: RenderView) -> tuple[float, float] | None:
return None
-def view_label(view: RenderView, index: int, total: int) -> str:
- """``VIEW 3/8 — front · az 0° el 8°`` (+ ``t=1.5s`` / mode when relevant)."""
- bits = [f"VIEW {index}/{total} — {view.name}"]
- azel = view_az_el(view)
- if azel is not None:
- bits.append(f"az {azel[0]:.0f}° el {azel[1]:.0f}°")
- if view.mode and view.mode != "shaded":
- bits.append(view.mode)
- if view.time_s is not None:
- bits.append(f"t={view.time_s:g}s")
- return " · ".join(bits)
-
-
def _cache_key(src: Path, max_px: int, label: str) -> str:
st = src.stat()
h = hashlib.sha1(f"{src.resolve()}|{st.st_mtime_ns}|{st.st_size}|{max_px}|{label}".encode())
diff --git a/harness/tests/compare_bench/test_bench_shared.py b/harness/tests/compare_bench/test_bench_shared.py
index 60e8ea8c..eacdea22 100644
--- a/harness/tests/compare_bench/test_bench_shared.py
+++ b/harness/tests/compare_bench/test_bench_shared.py
@@ -28,9 +28,6 @@ def test_select_prompts_ids_tiers_limit():
def test_select_prompts_is_single_owner_for_both_drivers():
"""compare_backends deleted its private copy; both drivers filter identically."""
- b = _battery()
- opts = rb.BenchOptions(ids=[b.prompts[0].id])
- assert rb._select(b, opts) == select_prompts(b, ids=opts.ids)
assert cb.select_prompts is select_prompts and cb.default_run_track is rb.default_run_track