def load_initial_config(self, config, global_config=None): config_spec = self.config_spec config_copy = copy.deepcopy(config) # Apply defaults, then globals, then new config values # Defaults new_config = mureilbuilder.collect_defaults(config_spec) # Globals if global_config: mureilbuilder.update_with_globals(new_config, global_config, config_spec) # New config values new_config.update(config_copy) # Apply conversions to config mureilbuilder.apply_conversions(new_config, config_spec) # And check that all of the required parameters are there mureilbuilder.check_required_params(new_config, config_spec) self.config = new_config return
def update_from_config_spec(self): """Reapply the config_spec, which may have been changed in process_initial_config. Applies any new defaults and applies conversions. """ # Get defaults new_config = mureilbuilder.collect_defaults(self.config_spec) # Copy defaults to params that are not in self.config already for (key, value) in new_config.iteritems(): if key not in self.config: self.config[key] = value # Apply conversions to config mureilbuilder.apply_conversions(self.config, self.config_spec)
def load_initial_config(self, config, global_config=None): config_spec = self.config_spec config_copy = copy.deepcopy(config) # Apply defaults, then new config values # Defaults new_config = mureilbuilder.collect_defaults(config_spec) # New config values new_config.update(config_copy) # Apply conversions to config mureilbuilder.apply_conversions(new_config, config_spec) self.config = new_config return