def _dict_to_opt_stream(d, s): tmp_d = {} for (name, val) in d.items(): tmp_d[lib_to_orig_opt_rep(name)] = lib_to_orig_opt_rep(val) opt_stream_utils.dict_to_opt_stream(tmp_d, s)
def write_config_dict(d): """ Writes the configuration dictionary to a predefined file (defined in consts.py). """ log_utils.debug('writing config dict') custom_dict = tidy_opt_utils.names_dicts_to_dict(d[consts.custom_opts_names_dicts_category]) tidy_opt_utils.write_dict(custom_dict, consts.custom_opt_file_name) tmp_d = {} for k in [k for k in d.keys() if k != consts.custom_opts_names_dicts_category]: tmp_d[k] = d[k] f_name = os.path.join(gen_utils.data_dir(), consts.config_f_name) f = open(f_name, 'w') opt_stream_utils.dict_to_opt_stream(tmp_d, f) f.close() log_utils.debug('wrote config dict')