added the possibility of having the lenght of the

dataset
This commit is contained in:
Karma Riuk
2025-03-14 11:59:37 +01:00
parent 242d7f6a77
commit 468f793ded

View File

@ -28,6 +28,9 @@ class DatasetEntry:
class Dataset: class Dataset:
entries: List = field(default_factory=list) entries: List = field(default_factory=list)
def __len__(self) -> int:
return len(self.entries)
def to_json(self, filename: str): def to_json(self, filename: str):
"""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: