Load notes from file. Returns empty list if file doesn't exist (lazy loading).
(self)
| 67 | } |
| 68 | |
| 69 | def _load_from_file(self) -> list: |
| 70 | """Load notes from file. |
| 71 | |
| 72 | Returns empty list if file doesn't exist (lazy loading). |
| 73 | """ |
| 74 | if not self.memory_file.exists(): |
| 75 | return [] |
| 76 | |
| 77 | try: |
| 78 | return json.loads(self.memory_file.read_text()) |
| 79 | except Exception: |
| 80 | return [] |
| 81 | |
| 82 | def _save_to_file(self, notes: list): |
| 83 | """Save notes to file. |