MCPcopy Create free account
hub / github.com/VectifyAI/OpenKB / remove_by_hash

Method remove_by_hash

openkb/state.py:95–107  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers 3

_add_single_file_lockedFunction · 0.95
removeFunction · 0.95

Calls 1

_persistMethod · 0.95

Tested by 1