#NEWLINE# @ classmethod #NEWLINE# def load_config_file( cls , filename , filetype = None , paths = None ) : #NEWLINE# #INDENT# if ( not paths ) : #NEWLINE# #INDENT# paths = [ '.' ] #NEWLINE# #UNINDENT# if ( cls is None ) : #NEWLINE# #INDENT# if ( filename . lower ( ) . endswith ( '.yaml' ) or filename . lower ( ) . endswith ( '.yml' ) ) : #NEWLINE# #INDENT# filetype = 'yaml' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if filename . lower ( ) . endswith ( '.json' ) : #NEWLINE# #INDENT# filetype = 'json' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( filename . lower ( ) . endswith ( '.conf' ) or filename . lower ( ) . endswith ( '.ini' ) ) : #NEWLINE# #INDENT# filetype = 'ini' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# filetype = 'yaml' #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# data = cls . _load_file ( filename , paths ) #NEWLINE# if ( data is None ) : #NEWLINE# #INDENT# raise ConfigurationError ( ( 'Cannot find or read config file: %s' % filename ) ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# loader = getattr ( cls , ( '_load_%s_config' % filetype ) ) #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# raise ConfigurationError ( ( 'Unknown config file type: %s' % filetype ) ) #NEWLINE# #UNINDENT# return loader ( data , filename = filename )