Example #1
0
def encode_and_decode_vint(x):
    f = BytesIO()
    vint.write_vint(f, x)
    return vint.read_vint(BytesIO(f.getvalue()))
Example #2
0
File: tvint.py Project: 3v/bup
def encode_and_decode_vint(x):
    f = StringIO()
    vint.write_vint(f, x)
    return vint.read_vint(StringIO(f.getvalue()))
Example #3
0
File: vfs.py Project: bup/bup
def read_ioerror(port):
    mask = read_vuint(port)
    no = read_vint(port) if 1 & mask else None
    msg = read_bvec(port).decode('utf-8') if 2 & mask else None
    term = read_resolution(port) if 4 & mask else None
    return IOError(errno=no, message=msg, terminus=term)
Example #4
0
def encode_and_decode_vint(x):
    f = BytesIO()
    vint.write_vint(f, x)
    return vint.read_vint(BytesIO(f.getvalue()))
Example #5
0
def read_ioerror(port):
    mask = read_vuint(port)
    no = read_vint(port) if 1 & mask else None
    msg = read_bvec(port).decode('utf-8') if 2 & mask else None
    term = read_resolution(port) if 4 & mask else None
    return IOError(errno=no, message=msg, terminus=term)
Example #6
0
def encode_and_decode_vint(x):
    f = StringIO()
    vint.write_vint(f, x)
    return vint.read_vint(StringIO(f.getvalue()))