MCPcopy Create free account
hub / github.com/apple/ml-pointersect / __init__

Method __init__

cdslib/core/data/chunked_memmap.py:43–60  ·  view source on GitHub ↗

Create memmaps that store chunked of the samples. Args: working_dir: the directory where all the chunked memmaps are stored. remove_exist: whether or not to remove existing content in the working_dir. Set to False if wa

(self, working_dir: str, remove_exist=False)

Source from the content-addressed store, hash-verified

41 """
42
43 def __init__(self, working_dir: str, remove_exist=False):
44 """Create memmaps that store chunked of the samples.
45
46 Args:
47 working_dir:
48 the directory where all the chunked memmaps are stored.
49 remove_exist:
50 whether or not to remove existing content in the working_dir.
51 Set to False if want to read existed chunked_memmap.
52 """
53 self.working_dir = working_dir
54 self.info_filename = os.path.join(self.working_dir, "info.json")
55
56 if remove_exist and os.path.exists(self.working_dir):
57 shutil.rmtree(self.working_dir)
58
59 # read the memmaps if exist
60 self._read_info()
61
62 def _read_info(self):
63 """Read the info file if existed, else set everything to None."""

Callers

nothing calls this directly

Calls 1

_read_infoMethod · 0.95

Tested by

no test coverage detected