#NEWLINE# def read_header( ofile ) : #NEWLINE# #INDENT# 'Read the header of the iterable ofile.' #NEWLINE# i = next ( ofile ) #NEWLINE# while r_comment . match ( i ) : #NEWLINE# #INDENT# i = next ( ofile ) #NEWLINE# #UNINDENT# relation = None #NEWLINE# attributes = [ ] #NEWLINE# while ( not r_datameta . match ( i ) ) : #NEWLINE# #INDENT# m = r_headerline . match ( i ) #NEWLINE# if m : #NEWLINE# #INDENT# isattr = r_attribute . match ( i ) #NEWLINE# if isattr : #NEWLINE# #INDENT# ( name , type , i ) = tokenize_attribute ( ofile , i ) #NEWLINE# attributes . append ( ( name , type ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# isrel = r_relation . match ( i ) #NEWLINE# if isrel : #NEWLINE# #INDENT# relation = isrel . group ( 1 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise ValueError ( ( 'Error parsing line %s' % i ) ) #NEWLINE# #UNINDENT# i = next ( ofile ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# i = next ( ofile ) #NEWLINE# #UNINDENT# #UNINDENT# return ( relation , attributes )