Exemplo n.º 1
0
 def upload_chunk(self, offset, data):
     if offset is None:
         new_offset = self.tell() + len(data)
     else:
         new_offset = offset + len(data)
     self.send(event.file_write(self.id(), event.encode(self.CODEC, data),
         offset=offset, codec=self.CODEC))
     self.seek(new_offset)
     return None
Exemplo n.º 2
0
 def upload_chunk(self, offset, data):
     if offset is None:
         new_offset = self.tell() + len(data)
     else:
         new_offset = offset + len(data)
     self.send(
         event.file_write(self.id(),
                          event.encode(self.CODEC, data),
                          offset=offset,
                          codec=self.CODEC))
     self.seek(new_offset)
     return None
Exemplo n.º 3
0
 def test(codec, f):
     for s in ["Hello World!"]:
         assert event.decode(codec, f(s)) == s
         assert event.decode(codec, event.encode(codec, s)) == s