| 85 | self._save() |
| 86 | |
| 87 | def _open(self) -> None: |
| 88 | try: |
| 89 | with open(self.path, "rb") as f: |
| 90 | state = pickle.load(f) |
| 91 | # Read the states |
| 92 | self.tagprogress = state.get("tagprogress", {}) |
| 93 | self.taghistory = state.get("taghistory", set()) |
| 94 | except Exception as exc: |
| 95 | # The `pickle` module can emit all sorts of exceptions during |
| 96 | # unpickling, including ImportError. We use a catch-all |
| 97 | # exception to avoid enumerating them all (the docs don't even have a |
| 98 | # full list!). |
| 99 | log.debug("state file could not be read: {}", exc) |
| 100 | |
| 101 | def _save(self) -> None: |
| 102 | try: |