Exemple #1
0
def write_ioerror(port, ex):
    assert isinstance(ex, IOError)
    write_vuint(port, (1 if ex.errno is not None else 0)
                | (2 if ex.strerror is not None else 0)
                | (4 if ex.terminus is not None else 0))
    if ex.errno is not None:
        write_vint(port, ex.errno)
    if ex.strerror is not None:
        write_bvec(port, ex.strerror.encode('utf-8'))
    if ex.terminus is not None:
        write_resolution(port, ex.terminus)
Exemple #2
0
Fichier : vfs.py Projet : bup/bup
def write_ioerror(port, ex):
    assert isinstance(ex, IOError)
    write_vuint(port,
                (1 if ex.errno is not None else 0)
                | (2 if ex.message is not None else 0)
                | (4 if ex.terminus is not None else 0))
    if ex.errno is not None:
        write_vint(port, ex.errno)
    if ex.message is not None:
        write_bvec(port, ex.message.encode('utf-8'))
    if ex.terminus is not None:
        write_resolution(port, ex.terminus)
Exemple #3
0
def encode_and_decode_vint(x):
    f = BytesIO()
    vint.write_vint(f, x)
    return vint.read_vint(BytesIO(f.getvalue()))
Exemple #4
0
Fichier : tvint.py Projet : 3v/bup
def encode_and_decode_vint(x):
    f = StringIO()
    vint.write_vint(f, x)
    return vint.read_vint(StringIO(f.getvalue()))
Exemple #5
0
def encode_and_decode_vint(x):
    f = BytesIO()
    vint.write_vint(f, x)
    return vint.read_vint(BytesIO(f.getvalue()))
Exemple #6
0
def encode_and_decode_vint(x):
    f = StringIO()
    vint.write_vint(f, x)
    return vint.read_vint(StringIO(f.getvalue()))