#NEWLINE# def _next_case( self ) : #NEWLINE# #INDENT# ' Generator which returns Cases one at a time. ' #NEWLINE# uuid = parent_uuid = msg = '' #NEWLINE# uuid_field = parent_uuid_field = msg_field = None #NEWLINE# if ( self . headers is None ) : #NEWLINE# #INDENT# input_fields = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# input_fields = self . headers #NEWLINE# #UNINDENT# output_fields = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for row in self . data : #NEWLINE# #INDENT# if self . _need_fieldnames : #NEWLINE# #INDENT# if ( '/INPUTS' in row ) : #NEWLINE# #INDENT# ( input_fields , output_fields ) = self . _parse_fieldnames ( row ) #NEWLINE# self . timestamp_field = 1 #NEWLINE# uuid_field = ( row . index ( '/METADATA' ) + 1 ) #NEWLINE# parent_uuid_field = ( uuid_field + 1 ) #NEWLINE# msg_field = ( uuid_field + 2 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( self . headers is None ) : #NEWLINE# #INDENT# for ( i , field ) in enumerate ( row ) : #NEWLINE# #INDENT# if ( field == 'timestamp' ) : #NEWLINE# #INDENT# self . timestamp_field = i #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# input_fields [ i ] = field #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# self . _need_fieldnames = False #NEWLINE# continue #NEWLINE# #UNINDENT# if ( uuid_field is not None ) : #NEWLINE# #INDENT# uuid = row [ uuid_field ] #NEWLINE# parent_uuid = row [ parent_uuid_field ] #NEWLINE# msg = row [ msg_field ] #NEWLINE# #UNINDENT# inputs = [ ] #NEWLINE# for ( i , field ) in input_fields . iteritems ( ) : #NEWLINE# #INDENT# if ( row [ i ] in [ 'True' , 'False' ] ) : #NEWLINE# #INDENT# row [ i ] = bool ( row [ i ] ) #NEWLINE# #UNINDENT# inputs . append ( ( field , row [ i ] ) ) #NEWLINE# #UNINDENT# outputs = [ ] #NEWLINE# for ( i , field ) in output_fields . iteritems ( ) : #NEWLINE# #INDENT# outputs . append ( ( field , row [ i ] ) ) #NEWLINE# #UNINDENT# exc = ( None if ( not msg ) else Exception ( msg ) ) #NEWLINE# ( yield Case ( inputs = inputs , outputs = outputs , exc = exc , parent_uuid = parent_uuid ) ) #NEWLINE# #UNINDENT# self . _need_fieldnames = True