Пример #1
0
def write_varint(value: types.uint, io: IO):
    """
    Write unsigned `VarInt` to a file-like object.
    """
    while value > 0x7F:
        io.write(bytes((value & 0x7F | 0x80, )))
        value >>= 7
    io.write(bytes((value, )))
Пример #2
0
 def dump(self, value: Any, io: IO):
     unsigned_varint_serializer.dump(len(value), io)
     io.write(value)
Пример #3
0
 def dump(self, value: Any, io: IO):
     io.write(pack('<d', value))
Пример #4
0
 def dump(self, value: Any, io: IO):
     io.write(b'\x01' if value else b'\x00')