(self)
| 151 | } |
| 152 | |
| 153 | def save(self) -> None: |
| 154 | self.path.parent.mkdir(parents=True, exist_ok=True) |
| 155 | tmp = self.path.with_suffix(".json.tmp") |
| 156 | tmp.write_text( |
| 157 | json.dumps(self.to_dict(), ensure_ascii=False, indent=2, default=str), |
| 158 | encoding="utf-8", |
| 159 | ) |
| 160 | os.replace(tmp, self.path) |
| 161 | |
| 162 | def record_turn( |
| 163 | self, |
no test coverage detected