Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
else:
# assume its a base object
total_rela_offset = data_rela_offset
# END handle type id
abs_data_offset = offset + total_rela_offset
if as_stream:
stream = DecompressMemMapReader(buffer(data, total_rela_offset), False, uncomp_size)
if delta_info is None:
return abs_data_offset, OPackStream(offset, type_id, uncomp_size, stream)
else:
return abs_data_offset, ODeltaPackStream(offset, type_id, uncomp_size, delta_info, stream)
else:
if delta_info is None:
return abs_data_offset, OPackInfo(offset, type_id, uncomp_size)
else:
return abs_data_offset, ODeltaPackInfo(offset, type_id, uncomp_size, delta_info)
# END handle info
else:
# assume its a base object
total_rela_offset = data_rela_offset
# END handle type id
abs_data_offset = offset + total_rela_offset
if as_stream:
stream = DecompressMemMapReader(buffer(data, total_rela_offset), False, uncomp_size)
if delta_info is None:
return abs_data_offset, OPackStream(offset, type_id, uncomp_size, stream)
else:
return abs_data_offset, ODeltaPackStream(offset, type_id, uncomp_size, delta_info, stream)
else:
if delta_info is None:
return abs_data_offset, OPackInfo(offset, type_id, uncomp_size)
else:
return abs_data_offset, ODeltaPackInfo(offset, type_id, uncomp_size, delta_info)
# END handle info
def __new__(cls, packoffset, type, size, stream, *args):
"""Helps with the initialization of subclasses"""
return tuple.__new__(cls, (packoffset, type, size, stream))
#{ Stream Reader Interface
def read(self, size=-1):
return self[3].read(size)
@property
def stream(self):
return self[3]
#} END stream reader interface
class ODeltaPackStream(ODeltaPackInfo):
"""Provides a stream outputting the uncompressed offset delta information"""
__slots__ = tuple()
def __new__(cls, packoffset, type, size, delta_info, stream):
return tuple.__new__(cls, (packoffset, type, size, delta_info, stream))
#{ Stream Reader Interface
def read(self, size=-1):
return self[4].read(size)
@property
def stream(self):
return self[4]
#} END stream reader interface