Beispiel #1
0
 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)
Beispiel #2
0
 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)
Beispiel #3
0
 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)
Beispiel #4
0
 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)
Beispiel #5
0
 def update_meta(self):
     fileFn.write_json(self.meta_path, data=self.meta_data)