def merge_defn_dict(self, _defn_dict): """ Merges a definition file into the current object """ self.config_defn = utils.merge_dict(self.config_defn, _defn_dict) self.update_restricted_items(_defn_dict) if self.db is not None: self.save_defn_to_db(_defn_dict)
def get_default_config(self): """ JSON format: [module]['sections'][section]['settings'][setting][metadata] section is the section in the ini file setting is the name in the ini file """ config_defaults = {} if self.db is not None: areas = self.get_areas() for area in areas: area_dict = self.get_defn(area) defaults_dict = self.get_default_config_area(area, area_dict) config_defaults = utils.merge_dict(config_defaults, defaults_dict) else: for area, area_dict in self.config_defn.items(): defaults_dict = self.get_default_config_area(area, area_dict) config_defaults = utils.merge_dict(config_defaults, defaults_dict) return config_defaults
def import_manifest(self): try: json_settings = importlib.resources.read_text( self.plugin_path, PLUGIN_MANIFEST_FILE) settings = json.loads(json_settings) self.namespace = settings['name'] self.instances = ['Default'] self.plugin_db.save_plugin(settings) self.plugin_db.save_instance(self.namespace, self.instances[0], '') self.logger.debug('Plugin Manifest file loaded at {}'.format( self.plugin_path)) self.plugin_settings = utils.merge_dict(self.plugin_settings, settings, True) except FileNotFoundError: self.logger.warning('PLUGIN MANIFEST FILE NOT FOUND AT {}'.format( self.plugin_path))
def merge_defn_obj(self, _defn_obj): """ will merge and terminate defn object """ self.config_defn = utils.merge_dict(self.config_defn, _defn_obj.config_defn) self.update_restricted_items(_defn_obj.config_defn)
def merge_config(self, _delta_config_dict): self.data = utils.merge_dict(self.data, _delta_config_dict, ignore_conflicts=True)