#NEWLINE# def LoadFromFile( self , yamlfile , _override = True , _allow_undeclared = False ) : #NEWLINE# #INDENT# "Loads the configuration from a file.\n\n    Parsed contents must be a single dict mapping config key to value.\n\n    Args:\n      yamlfile: The opened file object to load configuration from.\n      See LoadFromDict() for other args' descriptions.\n\n    Raises:\n      ConfigurationInvalidError: If configuration file can't be read, or can't\n          be parsed as either YAML (or JSON, which is a subset of YAML).\n    " #NEWLINE# self . _logger . info ( 'Loading configuration from file: %s' , yamlfile ) #NEWLINE# try : #NEWLINE# #INDENT# parsed_yaml = self . _modules [ 'yaml' ] . safe_load ( yamlfile . read ( ) ) #NEWLINE# #UNINDENT# except self . _modules [ 'yaml' ] . YAMLError as exception : #NEWLINE# #INDENT# raise self . ConfigurationInvalidError ( ( 'Failed to load from %s as YAML' % yamlfile ) , exception ) #NEWLINE# #UNINDENT# if ( not isinstance ( parsed_yaml , dict ) ) : #NEWLINE# #INDENT# raise self . ConfigurationInvalidError ( 'YAML parsed, but wrong type, should be dict' , parsed_yaml ) #NEWLINE# #UNINDENT# self . _logger . debug ( 'Configuration loaded from file: %s' , parsed_yaml ) #NEWLINE# self . LoadFromDict ( parsed_yaml , _override = _override , _allow_undeclared = _allow_undeclared )