#NEWLINE# def get_schema( self , filename ) : #NEWLINE# #INDENT# '\n        Guess schema using messytables\n        ' #NEWLINE# table_set = self . read_file ( filename ) #NEWLINE# if ( table_set is None ) : #NEWLINE# #INDENT# return [ ] #NEWLINE# #UNINDENT# row_set = table_set . tables [ 0 ] #NEWLINE# ( offset , headers ) = headers_guess ( row_set . sample ) #NEWLINE# row_set . register_processor ( headers_processor ( headers ) ) #NEWLINE# row_set . register_processor ( offset_processor ( ( offset + 1 ) ) ) #NEWLINE# types = type_guess ( row_set . sample , strict = True ) #NEWLINE# sample = next ( row_set . sample ) #NEWLINE# clean = ( lambda v : ( str ( v ) if ( not isinstance ( v , str ) ) else v ) ) #NEWLINE# schema = [ ] #NEWLINE# for ( i , h ) in enumerate ( headers ) : #NEWLINE# #INDENT# schema . append ( [ h , str ( self [ i ] ) , clean ( sample [ i ] . value ) ] ) #NEWLINE# #UNINDENT# return schema