(readfn)
return i
Reads a variable-length encoded integer.

    :param readfn: a callable that reads a given number of bytes,
        like file.read().
Reads a variable-length encoded integer.
Reads a variable - length encoded integer .
def read_varint(readfn):
    """
    Reads a variable-length encoded integer.

    :param readfn: a callable that reads a given number of bytes,
        like file.read().
    """

    b = ord(readfn(1))
    i = b & 0x7F

    shift = 7
    while b & 0x80 != 0:
        b = ord(readfn(1))
        i |= (b & 0x7F) << shift
        shift += 7
    return i
def read_varint ( readfn ) : b = ord ( readfn ( 1 ) ) i = b & 0x7F shift = 7 while b & 0x80 != 0 : b = ord ( readfn ( 1 ) ) i |= ( b & 0x7F ) << shift shift += 7 return i