(path: Path)
| 63 | |
| 64 | |
| 65 | def _load_solution(path: Path) -> Solution: |
| 66 | sol_dict = json.loads(path.read_text()) |
| 67 | # Resolve source file contents relative to the solution JSON directory. |
| 68 | sol_dir = path.parent |
| 69 | for src in sol_dict.get("sources", []): |
| 70 | if not src.get("content"): |
| 71 | src_path = sol_dir / src["path"] |
| 72 | if src_path.exists(): |
| 73 | src["content"] = src_path.read_text() |
| 74 | return Solution(**sol_dict) |
| 75 | |
| 76 | |
| 77 | def _load_config(path: Optional[Path]) -> BenchmarkConfig: |