(self)
| 69 | return popped |
| 70 | |
| 71 | async def clear_session(self) -> None: |
| 72 | if not self.session_id: |
| 73 | return |
| 74 | file_path = self._items_path(self.session_id) |
| 75 | state_path = self._state_path(self.session_id) |
| 76 | try: |
| 77 | await asyncio.to_thread(file_path.unlink) |
| 78 | except FileNotFoundError: |
| 79 | pass |
| 80 | try: |
| 81 | await asyncio.to_thread(state_path.unlink) |
| 82 | except FileNotFoundError: |
| 83 | pass |
| 84 | self.session_id = "" |
| 85 | |
| 86 | def _items_path(self, session_id: str) -> Path: |
| 87 | return self._dir / f"{session_id}.json" |
no test coverage detected