From 468f793deddb7e482d8704dd12cd8e28c53838c8 Mon Sep 17 00:00:00 2001 From: Karma Riuk Date: Fri, 14 Mar 2025 11:59:37 +0100 Subject: [PATCH] added the possibility of having the lenght of the dataset --- dataset.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dataset.py b/dataset.py index 73fe264..3b150c1 100644 --- a/dataset.py +++ b/dataset.py @@ -28,6 +28,9 @@ class DatasetEntry: class Dataset: entries: List = field(default_factory=list) + def __len__(self) -> int: + return len(self.entries) + def to_json(self, filename: str): """Serialize the dataset to a JSON file""" with open(filename, "w", encoding="utf-8") as f: