#NEWLINE# def generic_visit( self , node ) : #NEWLINE# #INDENT# for ( field , old_value ) in iter_fields ( node ) : #NEWLINE# #INDENT# old_value = getattr ( node , field , None ) #NEWLINE# if isinstance ( old_value , list ) : #NEWLINE# #INDENT# new_values = [ ] #NEWLINE# for value in old_value : #NEWLINE# #INDENT# if isinstance ( value , AST ) : #NEWLINE# #INDENT# value = self . visit ( value ) #NEWLINE# if ( value is None ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( not isinstance ( value , AST ) ) : #NEWLINE# #INDENT# new_values . extend ( value ) #NEWLINE# continue #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# new_values . append ( value ) #NEWLINE# #UNINDENT# old_value [ : ] = new_values #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( old_value , AST ) : #NEWLINE# #INDENT# new_node = self . visit ( old_value ) #NEWLINE# if ( new_node is None ) : #NEWLINE# #INDENT# delattr ( node , field ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# setattr ( node , field , value ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# return node