(self)
| 42 | return updated |
| 43 | |
| 44 | def _read_unlocked(self) -> Any: |
| 45 | if not self.path.exists(): |
| 46 | return copy.deepcopy(self.default_factory()) |
| 47 | |
| 48 | raw = self.path.read_bytes() |
| 49 | if not raw.strip(): |
| 50 | return copy.deepcopy(self.default_factory()) |
| 51 | if orjson is not None: |
| 52 | return orjson.loads(raw) |
| 53 | return json.loads(raw.decode("utf-8")) |
| 54 | |
| 55 | def _write_unlocked(self, payload: Any) -> None: |
| 56 | self.path.parent.mkdir(parents=True, exist_ok=True) |