removed the from_json, because we don't use it

This commit is contained in:
Karma Riuk
2025-03-17 15:26:27 +01:00
parent 5e74c8738d
commit b2d7377d1f

View File

@ -41,20 +41,3 @@ class Dataset:
"""Serialize the dataset to a JSON file""" """Serialize the dataset to a JSON file"""
with open(filename, "w", encoding="utf-8") as f: with open(filename, "w", encoding="utf-8") as f:
json.dump(self, f, default=lambda o: o.__dict__, indent=4) json.dump(self, f, default=lambda o: o.__dict__, indent=4)
@staticmethod
def from_json(filename: str):
"""Load the dataset from a JSON file"""
with open(filename, "r", encoding="utf-8") as f:
data = json.load(f)
return Dataset(
entries=[
DatasetEntry(
metadata=Metadata(**entry["metadata"]),
files=[FileData(**file) for file in entry["files"]],
diffs_before=entry["diffs_before"],
comment=entry["comment"],
diffs_after=entry["diffs_after"]
) for entry in data["entries"]
]
)