def readAll(self, sz):
    buff = bytearray(sz)
    view = memoryview(buff)
    have = 0
    while have < sz:
      read_size = sz - have
      chunk_len = self.recv_into(view[have:], read_size)
      have += chunk_len
      if chunk_len == 0:
        raise EOFError()
    self._varz.bytes_recv(sz)
    return buff
dataset/ETHPy150Open steveniemitz/scales/scales/varz.py/VarzSocketWrapper.readAll/original