mirror of
https://github.com/karma-riuk/crab.git
synced 2025-07-05 13:38:12 +02:00
added the possibility of having the lenght of the
dataset
This commit is contained in:
@ -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:
|
||||||
|
Reference in New Issue
Block a user