#NEWLINE# def load_config( config_file ) : #NEWLINE# #INDENT# error = None #NEWLINE# paths = ( [ config_file ] if config_file else [ 'blockade.yaml' , 'blockade.yml' ] ) #NEWLINE# try : #NEWLINE# #INDENT# for path in paths : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# with open ( path ) as f : #NEWLINE# #INDENT# d = yaml . safe_load ( f ) #NEWLINE# return BlockadeConfig . from_dict ( d ) #NEWLINE# #UNINDENT# #UNINDENT# except IOError as e : #NEWLINE# #INDENT# if ( e . errno != errno . ENOENT ) : #NEWLINE# #INDENT# raise #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# error = path #NEWLINE# #UNINDENT# raise BlockadeError ( ( 'Failed to load config (from --config, ./blockade.yaml, or ./blockade.yml)' + ( str ( error ) if error else '' ) ) )