MCPcopy Create free account
hub / github.com/RightNow-AI/autokernel / load_from_file

Function load_from_file

kernelbench/bridge.py:446–462  ·  view source on GitHub ↗

Load a single problem from a standalone .py file.

(
    path: str,
    level: int = 1,
    problem_id: int = 0,
)

Source from the content-addressed store, hash-verified

444
445
446def load_from_file(
447 path: str,
448 level: int = 1,
449 problem_id: int = 0,
450) -> KernelBenchProblem:
451 """Load a single problem from a standalone .py file."""
452 p = Path(path)
453 if not p.exists():
454 print(f"ERROR: File not found: {path}")
455 sys.exit(1)
456 source = p.read_text(encoding="utf-8")
457 name = p.stem.replace("_", " ")
458 prob = KernelBenchProblem(
459 level=level, problem_id=problem_id, name=name, source_code=source,
460 )
461 prob.save_to_cache()
462 return prob
463
464
465# ---------------------------------------------------------------------------

Callers 1

mainFunction · 0.85

Calls 2

save_to_cacheMethod · 0.95
KernelBenchProblemClass · 0.85

Tested by

no test coverage detected