def __update_config_attr(attr, value, section): if isinstance(value, list): value = json.dumps(value) if attr not in ConfigHandler[section].keys( ) or ConfigHandler[section][attr] != value: ConfigHandler.set(section, key=attr, value=value, overwrite=True)
def __update_config_attr(attr, value, section): if isinstance(value, list): value = json.dumps(value) if attr not in ConfigHandler[section].keys() or ConfigHandler[section][attr] != value: # print('updating attribute {0}:{1}..'.format(section, attr)) # print(' {0} -> {1}'.format(repr(ConfigHandler[section][attr]), repr(value))) ConfigHandler.set(section, key=attr, value=value, overwrite=True)
def __update_config(self): for section in ['SNAP', 'OUTPUT', 'URL']: if section not in ConfigHandler.sections: # print('creating section {}..'.format(section)) ConfigHandler.add_section(section) for key in self.identifiers + ['auxdatapath', 'properties']: if hasattr(self, key): self.__update_config_attr(key, getattr(self, key), 'SNAP') for key, value in self.snap_properties.items(): self.__update_config_attr(key, value, 'OUTPUT')
def __update_config(self): if 'GAMMA' not in ConfigHandler.sections: ConfigHandler.add_section('GAMMA') for attr in ['home', 'version']: self.__update_config_attr(attr, getattr(self, attr), 'GAMMA')