#NEWLINE# def read_header( stream ) : #NEWLINE# #INDENT# 'Return tuple(version_long, num_entries) from the given stream' #NEWLINE# type_id = stream . read ( 4 ) #NEWLINE# if ( type_id != b'DIRC' ) : #NEWLINE# #INDENT# raise AssertionError ( ( 'Invalid index file header: %r' % type_id ) ) #NEWLINE# #UNINDENT# ( version , num_entries ) = unpack ( '>LL' , stream . read ( ( 4 * 2 ) ) ) #NEWLINE# assert ( version in ( 1 , 2 ) ) #NEWLINE# return ( version , type_id )