Load all lessons from disk.
(self)
| 374 | logger.info("Appended %d lessons to evolution store", len(lessons)) |
| 375 | |
| 376 | def load_all(self) -> list[LessonEntry]: |
| 377 | """Load all lessons from disk.""" |
| 378 | if not self._lessons_path.exists(): |
| 379 | return [] |
| 380 | lessons: list[LessonEntry] = [] |
| 381 | for line in self._lessons_path.read_text(encoding="utf-8").splitlines(): |
| 382 | line = line.strip() |
| 383 | if not line: |
| 384 | continue |
| 385 | try: |
| 386 | data = json.loads(line) |
| 387 | lessons.append(LessonEntry.from_dict(data)) |
| 388 | except (json.JSONDecodeError, TypeError): |
| 389 | continue |
| 390 | return lessons |
| 391 | |
| 392 | def query_for_stage( |
| 393 | self, stage_name: str, *, max_lessons: int = 5 |