#NEWLINE# @ threads . Synchronized #NEWLINE# def LoadFromDict( self , dictionary , _override = True , _allow_undeclared = False ) : #NEWLINE# #INDENT# "Loads the config with values from a dictionary instead of a file.\n\n    This is meant for testing and bin purposes and shouldn't be used in most\n    applications.\n\n    Args:\n      dictionary: The dictionary containing config keys/values to update.\n      _override: If True, new values will override previous values.\n      _allow_undeclared: If True, silently load undeclared keys, otherwise\n          warn and ignore the value.  Typically used for loading config\n          files before declarations have been evaluated.\n    " #NEWLINE# undeclared_keys = [ ] #NEWLINE# for ( key , value ) in dictionary . iteritems ( ) : #NEWLINE# #INDENT# if ( ( key not in self . _declarations ) and ( not _allow_undeclared ) ) : #NEWLINE# #INDENT# undeclared_keys . append ( key ) #NEWLINE# continue #NEWLINE# #UNINDENT# if ( key in self . _loaded_values ) : #NEWLINE# #INDENT# if _override : #NEWLINE# #INDENT# self . _logger . info ( 'Overriding previously loaded value for %s (%s) with value: %s' , key , self . _loaded_values [ key ] , value ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . _logger . info ( 'Ignoring new value (%s), keeping previous value for %s: %s' , value , key , self . _loaded_values [ key ] ) #NEWLINE# continue #NEWLINE# #UNINDENT# #UNINDENT# self . _loaded_values [ key ] = value #NEWLINE# #UNINDENT# if undeclared_keys : #NEWLINE# #INDENT# self . _logger . warning ( 'Ignoring undeclared configuration keys: %s' , _allow_undeclared )