def load_configuration(arg_list, log_printer, arg_parser=None):
 cli_sections = parse_cli(arg_list=arg_list, arg_parser=arg_parser)
 check_conflicts(cli_sections)
 if (bool(cli_sections['default'].get('find_config', 'False')) and (str(cli_sections['default'].get('config')) == '')):
  cli_sections['default'].add_or_create_setting(Setting('config', re.escape(find_user_config(os.getcwd()))))
 targets = []
 for item in list(cli_sections['default'].contents.pop('targets', '')):
  targets.append(item.lower())
 if bool(cli_sections['default'].get('no_config', 'False')):
  sections = cli_sections
 else:
  base_sections = load_config_file(Constants.system_coafile, log_printer)
  user_sections = load_config_file(Constants.user_coafile, log_printer, silent=True)
  default_config = str(base_sections['default'].get('config', '.coafile'))
  user_config = str(user_sections['default'].get('config', default_config))
  config = os.path.abspath(str(cli_sections['default'].get('config', user_config)))
  try:
   save = bool(cli_sections['default'].get('save', 'False'))
  except ValueError:
   save = True
  coafile_sections = load_config_file(config, log_printer, silent=save)
  sections = merge_section_dicts(base_sections, user_sections)
  sections = merge_section_dicts(sections, coafile_sections)
  sections = merge_section_dicts(sections, cli_sections)
 for section in sections:
  if (section != 'default'):
   sections[section].defaults = sections['default']
 str_log_level = str(sections['default'].get('log_level', '')).upper()
 log_printer.log_level = LOG_LEVEL.str_dict.get(str_log_level, LOG_LEVEL.INFO)
 return (sections, targets)

def load_configuration ( arg_list , log_printer , arg_parser = None ) : cli_sections = parse_cli ( arg_list = arg_list , arg_parser = arg_parser ) check_conflicts ( cli_sections ) if ( bool ( cli_sections [ 'default' ] . get ( 'find_config' , 'False' ) ) and ( str ( cli_sections [ 'default' ] . get ( 'config' ) ) == '' ) ) : cli_sections [ 'default' ] . add_or_create_setting ( Setting ( 'config' , re . escape ( find_user_config ( os . getcwd ( ) ) ) ) ) targets = [ ] for item in list ( cli_sections [ 'default' ] . contents . pop ( 'targets' , '' ) ) : targets . append ( item . lower ( ) ) if bool ( cli_sections [ 'default' ] . get ( 'no_config' , 'False' ) ) : sections = cli_sections else : base_sections = load_config_file ( Constants . system_coafile , log_printer ) user_sections = load_config_file ( Constants . user_coafile , log_printer , silent = True ) default_config = str ( base_sections [ 'default' ] . get ( 'config' , '.coafile' ) ) user_config = str ( user_sections [ 'default' ] . get ( 'config' , default_config ) ) config = os . path . abspath ( str ( cli_sections [ 'default' ] . get ( 'config' , user_config ) ) ) try : save = bool ( cli_sections [ 'default' ] . get ( 'save' , 'False' ) ) except ValueError : save = True coafile_sections = load_config_file ( config , log_printer , silent = save ) sections = merge_section_dicts ( base_sections , user_sections ) sections = merge_section_dicts ( sections , coafile_sections ) sections = merge_section_dicts ( sections , cli_sections ) for section in sections : if ( section != 'default' ) : sections [ section ] . defaults = sections [ 'default' ] str_log_level = str ( sections [ 'default' ] . get ( 'log_level' , '' ) ) . upper ( ) log_printer . log_level = LOG_LEVEL . str_dict . get ( str_log_level , LOG_LEVEL . INFO ) return ( sections , targets )
load a yaml rule file and fill in the relevant fields with objects .