#NEWLINE# def _update( self , * args , **kwargs ) : #NEWLINE# #INDENT# recursive = kwargs . get ( 'recursive' , False ) #NEWLINE# kwargs = kwargs . get ( 'kwargs' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# sources = [ ] #NEWLINE# if ( len ( args ) == 1 ) : #NEWLINE# #INDENT# if hasattr ( args [ 0 ] , 'iteritems' ) : #NEWLINE# #INDENT# sources . append ( args [ 0 ] . iteritems ( ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# sources . append ( iter ( args [ 0 ] ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if args : #NEWLINE# #INDENT# raise TypeError ( 'expected at most one positional argument' ) #NEWLINE# #UNINDENT# #UNINDENT# if kwargs : #NEWLINE# #INDENT# sources . append ( kwargs . iteritems ( ) ) #NEWLINE# #UNINDENT# for iterable in sources : #NEWLINE# #INDENT# for ( key , val ) in iterable : #NEWLINE# #INDENT# if ( self . has_key ( key ) and recursive and isinstance ( val , dict ) and isinstance ( self [ key ] , dict ) ) : #NEWLINE# #INDENT# if hasattr ( self [ key ] , 'recursive_update' ) : #NEWLINE# #INDENT# self [ key ] . recursive_update ( val ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self [ key ] . update ( val ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# self [ key ] = val