bagofholding.h5.triebag module
- class bagofholding.h5.triebag.TrieH5Bag(filepath: str | Path, *args: object, **kwargs: Any)[source]
Bases:
Bag,HasH5FileContext,ArrayPackerA bag using HDF5 files based on h5py.
Uses a trie structure to flatten the stored object. Compared to
bagofholding.h5.bag.H5Bag, this is advantageous for file sizes but (currently) has worse scaling for save times.The resulting HDF5 file cannot be directly related to the structure of the stored object, but must be re-mapped via mapping fields. Metadata is also lumped in with other string data to minimize the number of different h5 groups.
- get_bespoke_content_class(obj: object) type[BespokeItem[Any, Self]] | None[source]
- load(path: str = 'object', version_validator: Literal['exact', 'semantic-minor', 'semantic-major', 'none'] | Callable[[str, str], bool] = 'exact', version_scraping: dict[str, Callable[[str], str | None]] | None = None) Any[source]
- pack_array(obj: ndarray[tuple[int, ...], dtype[int8] | dtype[int16] | dtype[int32] | dtype[int64] | dtype[uint8] | dtype[uint16] | dtype[uint32] | dtype[uint64] | dtype[float16] | dtype[float32] | dtype[float64] | dtype[complex64] | dtype[complex128] | dtype[bool] | dtype[bytes_] | dtype[str_]], path: str) None[source]
- unpack_array(path: str) ndarray[tuple[int, ...], dtype[int8] | dtype[int16] | dtype[int32] | dtype[int64] | dtype[uint8] | dtype[uint16] | dtype[uint32] | dtype[uint64] | dtype[float16] | dtype[float32] | dtype[float64] | dtype[complex64] | dtype[complex128] | dtype[bool] | dtype[bytes_] | dtype[str_]][source]
- property unpacked_trie: StringTrie