#NEWLINE# def _dummy_modify( connect_spec , dn , directives ) : #NEWLINE# #INDENT# assert ( dn in db ) #NEWLINE# e = db [ dn ] #NEWLINE# for ( op , attr , vals ) in directives : #NEWLINE# #INDENT# if ( op == 'add' ) : #NEWLINE# #INDENT# assert len ( vals ) #NEWLINE# existing_vals = e . setdefault ( attr , set ( ) ) #NEWLINE# for val in vals : #NEWLINE# #INDENT# assert ( val not in existing_vals ) #NEWLINE# existing_vals . add ( val ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( op == 'delete' ) : #NEWLINE# #INDENT# assert ( attr in e ) #NEWLINE# existing_vals = e [ attr ] #NEWLINE# assert len ( existing_vals ) #NEWLINE# if ( not len ( vals ) ) : #NEWLINE# #INDENT# del e [ attr ] #NEWLINE# continue #NEWLINE# #UNINDENT# for val in vals : #NEWLINE# #INDENT# assert ( val in existing_vals ) #NEWLINE# existing_vals . remove ( val ) #NEWLINE# #UNINDENT# if ( not len ( existing_vals ) ) : #NEWLINE# #INDENT# del e [ attr ] #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( op == 'replace' ) : #NEWLINE# #INDENT# e . pop ( attr , None ) #NEWLINE# e [ attr ] = set ( vals ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise ValueError ( ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# return True