#NEWLINE# def parse_index( file_stream ) : #NEWLINE# #INDENT# lines = [ l . replace ( '\n' , '' ) for l in file_stream . readlines ( ) ] #NEWLINE# index = [ ] #NEWLINE# try : #NEWLINE# #INDENT# for l in lines : #NEWLINE# #INDENT# components = l . split ( ',' ) #NEWLINE# rdi = IndexEntry ( ) #NEWLINE# rdi . filename = components [ 0 ] #NEWLINE# rdi . cached_name = components [ 1 ] #NEWLINE# rdi . md5_checksum = components [ 2 ] #NEWLINE# rdi . size_in_bytes = int ( file_stream [ 3 ] ) #NEWLINE# if ( len ( components ) > 4 ) : #NEWLINE# #INDENT# rdi . compressed_size = int ( components [ 4 ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# rdi . compressed_size = 0 #NEWLINE# #UNINDENT# index . append ( rdi ) #NEWLINE# #UNINDENT# #UNINDENT# except Exception : #NEWLINE# #INDENT# raise ValueError ( 'Bad index file' ) #NEWLINE# #UNINDENT# return index