From 575132fdb548f520ea66d727984d3e8309bd44ca Mon Sep 17 00:00:00 2001 From: avishaihalev Date: Fri, 14 Jun 2024 23:57:10 -0700 Subject: [PATCH] add from_indexable clsmethod --- mmap_ninja/src/mmap_ninja/ragged.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/mmap_ninja/src/mmap_ninja/ragged.py b/mmap_ninja/src/mmap_ninja/ragged.py index 4fcd84f..666f767 100644 --- a/mmap_ninja/src/mmap_ninja/ragged.py +++ b/mmap_ninja/src/mmap_ninja/ragged.py @@ -190,3 +190,14 @@ def from_generator(cls, out_dir: Union[str, Path], sample_generator, batch_size: batch_ctor=cls.from_lists, **kwargs, ) + + @classmethod + def from_indexable(cls, out_dir: Union[str, Path], indexable, batch_size: int, verbose=False, **kwargs): + return base.from_indexable_base( + out_dir=out_dir, + indexable=indexable, + batch_size=batch_size, + verbose=verbose, + batch_ctor=cls.from_lists, + **kwargs, + )