Remove the entry keyed by ``file_hash``. Returns True if removed. Preferred over :meth:`remove_by_doc_name` when the caller already has the hash in hand — works regardless of whether the entry's metadata carries a ``doc_name`` field (legacy entries written before com
(self, file_hash: str)
| 93 | return False |
| 94 | |
| 95 | def remove_by_hash(self, file_hash: str) -> bool: |
| 96 | """Remove the entry keyed by ``file_hash``. Returns True if removed. |
| 97 | |
| 98 | Preferred over :meth:`remove_by_doc_name` when the caller already |
| 99 | has the hash in hand — works regardless of whether the entry's |
| 100 | metadata carries a ``doc_name`` field (legacy entries written |
| 101 | before commit c504e26 do not). |
| 102 | """ |
| 103 | if file_hash not in self._data: |
| 104 | return False |
| 105 | del self._data[file_hash] |
| 106 | self._persist() |
| 107 | return True |
| 108 | |
| 109 | # ------------------------------------------------------------------ |
| 110 | # Internal |