def read(self, n=None):
        if '' == self.buffer or 0 == n:
            return ''

        new_read = self.source.read(n) if None != n else self.source.read()
        finished = (None == n or len(new_read) != n)
        self.buffer += new_read

        if None != n:
            offset = min(n, self.hm.digest_size - len(self.buffer))
        else:
            offset = len(self.buffer) - self.hm.digest_size

        rv, self.buffer = self.buffer[:offset], self.buffer[offset:]

        # update hmac
        self.hm.update(rv)

        if finished:
            # check hash
            if not self.buffer == self.hm.digest():
                raise VerificationException('HMAC verification failed.')

        return rv
dataset/ETHPy150Open mbr/simplekv/simplekv/crypt.py/_HMACFileReader.read/swapped operands of `-`