#NEWLINE# def load_configs( path , name = 'configs' ) : #NEWLINE# #INDENT# abspath = os . path . abspath ( path ) #NEWLINE# ( dirname , filename ) = os . path . split ( filename ) #NEWLINE# sys_path = list ( sys . path ) #NEWLINE# argv_dir = os . path . dirname ( os . path . abspath ( sys . argv [ 0 ] ) ) #NEWLINE# with _workdir ( dirname ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# sys . path . remove ( argv_dir ) #NEWLINE# #UNINDENT# except ValueError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# sys . path . insert ( 0 , dirname ) #NEWLINE# module = _load_config_module ( abspath ) #NEWLINE# try : #NEWLINE# #INDENT# config_attr = getattr ( module , name ) #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# raise ImportError ( 'no {0!r} defined in module {1!r}' . format ( name , filename ) ) #NEWLINE# #UNINDENT# return tuple ( flatten ( config_attr ) ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# sys . path [ : ] = sys_path