def __unpack__(self, type_, buf, _size=None):
fmt = self.endian + type_
size = struct.calcsize(fmt) if _size is None else _size
try:
unpacked = struct.unpack(fmt, buf[:size]), buf[size:]
except struct.error as exc:
raise_from(UnpackError("Unable to unpack structure"), exc)
else:
return unpacked
评论列表
文章目录