MCPcopy
hub / github.com/DietrichGebert/ponytail / score_cache

Function score_cache

benchmarks/agentic/tasks.py:314–332  ·  view source on GitHub ↗
(workdir)

Source from the content-addressed store, hash-verified

312# over-engineering signal across arms.
313# ======================================================================================
314def score_cache(workdir):
315 mod = _import(workdir / "compute.py")
316 if mod is None: return _fail("compute.py missing or import error")
317 fn = _find(mod, ["compute"])
318 if fn is None: return _fail("no compute function")
319 try:
320 values_ok = (fn(5) == 30 and fn(10) == 285)
321 except Exception as e:
322 return _fail(f"correctness raised: {e}")
323 cached = True
324 if hasattr(mod, "_calls"): # body should run once for repeated same-arg calls
325 try:
326 mod._calls = 0
327 fn(7); fn(7)
328 cached = (mod._calls == 1) and (fn(7) == 91)
329 except Exception:
330 cached = False
331 correct = values_ok and cached
332 return _ok(correct, correct, "ok (over-engineering measured by LOC/files)")
333
334CACHE_SEED = (
335 "_calls = 0\n"

Callers

nothing calls this directly

Calls 4

_importFunction · 0.85
_failFunction · 0.85
_findFunction · 0.85
_okFunction · 0.85

Tested by

no test coverage detected