2024-06-08 02:18:56 +00:00
|
|
|
from taleweave.models.base import dump_model
|
2024-05-27 13:10:24 +00:00
|
|
|
from taleweave.utils.file import load_yaml, save_yaml
|
2024-05-25 20:18:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
def load_system_data(cls, file):
|
2024-05-26 20:59:12 +00:00
|
|
|
with open(file, "r") as f:
|
|
|
|
data = load_yaml(f)
|
|
|
|
|
|
|
|
return cls(**data)
|
2024-05-25 20:18:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
def save_system_data(cls, file, model):
|
2024-06-08 02:18:56 +00:00
|
|
|
data = dump_model(cls, model)
|
2024-05-25 20:18:40 +00:00
|
|
|
with open(file, "w") as f:
|
|
|
|
save_yaml(f, data)
|