#NEWLINE# def enable( self ) : #NEWLINE# #INDENT# self . options = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for ( name , operations ) in self . operations : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# value = self . options [ name ] #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# value = list ( getattr ( settings , name , [ ] ) ) #NEWLINE# #UNINDENT# for ( action , items ) in operations . items ( ) : #NEWLINE# #INDENT# if isinstance ( items , six . string_types ) : #NEWLINE# #INDENT# items = [ items ] #NEWLINE# #UNINDENT# if ( action == 'append' ) : #NEWLINE# #INDENT# value = ( value + [ item for item in items if ( item not in self ) ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( action == 'prepend' ) : #NEWLINE# #INDENT# value = ( [ item for item in items if ( item not in value ) ] + value ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( action == 'remove' ) : #NEWLINE# #INDENT# value = [ item for item in value if ( item not in items ) ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise ValueError ( ( 'Unsupported action: %s' % action ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# self . options [ name ] = value #NEWLINE# #UNINDENT# super ( modify_settings , self ) . enable ( )