(f, legacy=False, lazy_load_path=None)
return data
Read compressed data.
Read compressed data.
Read compressed data .
def decode_file(f, legacy=False, lazy_load_path=None):
    """Read compressed data."""
    #Old file format
    if legacy:
        return pickle.loads(zlib.decompress(f.read()))
    
    #New zip format (file version 26)
    try:
        data = RenameUnpickler.loads(f.read('data.pkl'))
        numpy_maps = []
        i = 0
        if lazy_load_path is None:
            while True:
                try:
                    numpy_maps.append(numpy.load(f.read('maps/{}.npy'.format(i))))
                except KeyError:
                    break
                i += 1
            
    #Original zip format
    except KeyError:
        data = RenameUnpickler.loads(f.read('_'))
        numpy_maps = [numpy.load(f.read(i)) for i in range(int(f.read('n')))]
    
    #Reconnect the numpy maps
    try:
        IterateMaps(data['Maps']).join(numpy_maps, _legacy=True)
    except KeyError:
        IterateMaps(data['Resolution']).join(numpy_maps, _legacy=False, _lazy_load_path=lazy_load_path)
        
    return data
def decode_file ( f , legacy = False , lazy_load_path = None ) : #Old file format if legacy : return pickle . loads ( zlib . decompress ( f . read ( ) ) ) #New zip format (file version 26) try : data = RenameUnpickler . loads ( f . read ( 'data.pkl' ) ) numpy_maps = [ ] i = 0 if lazy_load_path is None : while True : try : numpy_maps . append ( numpy . load ( f . read ( 'maps/{}.npy' . format ( i ) ) ) ) except KeyError : break i += 1 #Original zip format except KeyError : data = RenameUnpickler . loads ( f . read ( '_' ) ) numpy_maps = [ numpy . load ( f . read ( i ) ) for i in range ( int ( f . read ( 'n' ) ) ) ] #Reconnect the numpy maps try : IterateMaps ( data [ 'Maps' ] ) . join ( numpy_maps , _legacy = True ) except KeyError : IterateMaps ( data [ 'Resolution' ] ) . join ( numpy_maps , _legacy = False , _lazy_load_path = lazy_load_path ) return data