(self)
| 64 | # ----- Cache persistence ----- |
| 65 | |
| 66 | def save_to_cache(self) -> None: |
| 67 | self.cache_path.parent.mkdir(parents=True, exist_ok=True) |
| 68 | self.cache_path.write_text(self.source_code, encoding="utf-8") |
| 69 | meta_path = self.cache_path.with_suffix(".json") |
| 70 | meta = { |
| 71 | "level": self.level, |
| 72 | "problem_id": self.problem_id, |
| 73 | "name": self.name, |
| 74 | } |
| 75 | meta_path.write_text(json.dumps(meta, indent=2), encoding="utf-8") |
| 76 | |
| 77 | @classmethod |
| 78 | def load_from_cache(cls, level: int, problem_id: int) -> Optional["KernelBenchProblem"]: |
no outgoing calls
no test coverage detected