def meta_data(self, value): data_dict = self.meta_data if isinstance(value, tuple): key, value = value data_dict[key] = value elif isinstance(value, dict): data_dict.update(value) fileFn.write_json(self.meta_path, data_dict, sort_keys=True)
def update_meta(self): meta_dict = self.meta_data meta_dict["name"] = self.name meta_dict["type"] = self.type meta_dict["modified"] = datetime.now().strftime("%d/%m/%Y %H:%M:%S") meta_dict["model"] = meta_dict.get("model", "") if not meta_dict.get("created", ""): meta_dict["created"] = datetime.now().strftime("%d/%m/%Y %H:%M:%S") fileFn.write_json(self.meta_path, meta_dict)
def update(cls, new_config_dict): current_config = cls.load() # type: dict current_config.update(new_config_dict) fileFn.write_json(cls.get_config_path(), current_config, sort_keys=False)
def set_data(self, key, value): data = self.meta_data data[key] = value data["modified"] = datetime.now().strftime("%d/%m/%Y %H:%M:%S") fileFn.write_json(self.meta_path, data)
def update_meta(self): fileFn.write_json(self.meta_path, data=self.meta_data)