MCPcopy Create free account
hub / github.com/BIT-DataLab/LakeBench / _insert

Method _insert

join/LSH/datasketch/lsh.py:169–181  ·  view source on GitHub ↗
(self, key, minhash, check_duplication=True, buffer=False)

Source from the content-addressed store, hash-verified

167 # return MinHashLSHInsertionSession(self, buffer_size=buffer_size)
168
169 def _insert(self, key, minhash, check_duplication=True, buffer=False):
170 if len(minhash) != self.h:
171 raise ValueError("Expecting minhash with length %d, got %d"
172 % (self.h, len(minhash)))
173 if self.prepickle:
174 key = pickle.dumps(key)
175 # if check_duplication and key in self.keys:
176 # raise ValueError("The given key already exists")
177 Hs = [self._H(minhash.hashvalues[start:end])
178 for start, end in self.hashranges]
179 # self.keys.insert(key, *Hs, buffer=buffer)
180 for H, hashtable in zip(Hs, self.hashtables):
181 hashtable.insert(H, set([key]), buffer=buffer)
182
183 def query(self, minhash):
184 '''

Callers 2

insertMethod · 0.95
insertMethod · 0.45

Calls 1

insertMethod · 0.45

Tested by

no test coverage detected