def __setstate__(self, buf):
        '''
        This function is called when unpickling the b-bit MinHash object.
        Initialize the object with data in the buffer.
        '''
        try:
            self.seed, self.b, self.r, num_perm = \
                    struct.unpack_from(self._serial_fmt_params, buf, 0)
        except TypeError:
            self.seed, self.b, self.r, num_perm = \
                    struct.unpack_from(self._serial_fmt_params, buffer(buf), 0)
        offset = struct.calcsize(self._serial_fmt_params)
        self.hashvalues = np.zeros((num_perm,), dtype=np.uint32)
        # Reconstruct the hash values
        slot_size, n, num_blocks, total = self._bytesize()
        fmt = (num_blocks, self._serial_fmt_block) % "%d%s"
        try:
            blocks = struct.unpack_from(fmt, buf, offset)
        except TypeError:
            blocks = struct.unpack_from(fmt, buffer(buf), offset)
        mask = (1 << slot_size) - 1
        for i in range(num_blocks):
            start = i * n
            for j, _ in enumerate(self.hashvalues[start:start+n]):
                hv = (blocks[i] >> (n - 1 - j) * slot_size) & mask
                self.hashvalues[start+j] = np.uint32(hv)
dataset/ETHPy150Open ekzhu/datasketch/datasketch/b_bit_minhash.py/bBitMinHash.__setstate__/swapped operands of `%`