def __getstate__(self):
        '''
        This function is called when pickling the b-bit MinHash object.
        Returns a bytearray which will then be pickled.
        '''
        slot_size, n, num_blocks, total = self._bytesize()
        buffer = bytearray(total)
        blocks = np.zeros((num_blocks,), dtype=np.uint64)
        for i in range(num_blocks):
            # Obtain the current segment of n hashed values
            start = i * n
            hvs = self.hashvalues[start:start+n]
            # Store the n b-bit hashed values in the current block
            for j, hv in enumerate(hvs):
                blocks[i] |= np.uint64(hv << (n - 1 - j) * slot_size)
        fmt = self._serial_fmt_params + \
                "%d%s" % (num_blocks, self._serial_fmt_block)
        struct.pack_into(fmt, buffer, 0, self.seed, self.b, self.r, \
                self.hashvalues.size, *blocks)
        return buffer
dataset/ETHPy150Open ekzhu/datasketch/datasketch/b_bit_minhash.py/bBitMinHash.__getstate__/original