|
|
|
@ -102,7 +102,7 @@ class YamlSerializable(object):
@@ -102,7 +102,7 @@ class YamlSerializable(object):
|
|
|
|
|
|
|
|
|
|
ymlsls = [] |
|
|
|
|
for ymlsl_dict in ymlsl_dicts: |
|
|
|
|
ymlsls.append(cls._ymlserializable_from_dict(ymlsl_dict)) |
|
|
|
|
ymlsls.append(cls._from_dict(ymlsl_dict)) |
|
|
|
|
return ymlsls |
|
|
|
|
|
|
|
|
|
@classmethod |
|
|
|
@ -115,18 +115,18 @@ class YamlSerializable(object):
@@ -115,18 +115,18 @@ class YamlSerializable(object):
|
|
|
|
|
return ymlserializables_list |
|
|
|
|
|
|
|
|
|
@classmethod |
|
|
|
|
def _ymlserializable_from_dict(cls, ymldict): |
|
|
|
|
def _from_dict(cls, ymldict): |
|
|
|
|
if ymldict is None: |
|
|
|
|
return None |
|
|
|
|
|
|
|
|
|
# Extract the name |
|
|
|
|
ymlserializable_name = [*ymldict][0] |
|
|
|
|
ymlsl_name = [*ymldict][0] |
|
|
|
|
|
|
|
|
|
# Step into object |
|
|
|
|
ymldict = ymldict.get(ymlserializable_name) |
|
|
|
|
ymldict = ymldict.get(ymlsl_name) |
|
|
|
|
|
|
|
|
|
# Add name to dict |
|
|
|
|
ymldict['name'] = ymlserializable_name |
|
|
|
|
ymldict['name'] = ymlsl_name |
|
|
|
|
|
|
|
|
|
# Create empty instance |
|
|
|
|
ymlsl = cls() |
|
|
|
@ -143,6 +143,6 @@ class YamlSerializable(object):
@@ -143,6 +143,6 @@ class YamlSerializable(object):
|
|
|
|
|
|
|
|
|
|
@classmethod |
|
|
|
|
def _save_all_to_file(cls, ymlsls): |
|
|
|
|
ymlserializables_object = {cls._yaml_object_name() : ymlsls} |
|
|
|
|
ymlsls_object = {cls._yaml_object_name() : ymlsls} |
|
|
|
|
with open(cls._storage_file(), 'w') as file: |
|
|
|
|
yaml.dump(ymlserializables_object, file) |
|
|
|
|
yaml.dump(ymlsls_object, file) |
|
|
|
|