itsh5py.LazyHdfDict#
- class itsh5py.LazyHdfDict(_h5file=None, group='/', *args, **kwargs)[source]#
Helps loading data only if values from the dict are requested. This is done by reimplementing the __getitem__ method from dict. Other convenience functions are added to work with the hdf files as backend.
- Parameters
_h5file ('h5py.File', optional) – h5py File object or None
group (str, optional) – Group to anchor the LazyHdfDict into.
args – Passed to the parent UserDcit implemented type.
kwargs – Passed to the parent UserDcit implemented type.
Methods
__init__
([_h5file, group])clear
()close
()Closes the h5file if provided at initialization.
copy
()fromkeys
(iterable[, value])get
(k[,d])items
()keys
()pop
(k[,d])If key is not found, d is returned if given, otherwise KeyError is raised.
popitem
()as a 2-tuple; but raise KeyError if D is empty.
setdefault
(k[,d])unlazy
()Unpacks all datasets and closes the Lazy reference
update
([E, ]**F)If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v
values
()Attributes
Root group of the LazyHdfDict.
File handle of the h5py.File() object behind the LazyHdfDict.
- property h5file#
File handle of the h5py.File() object behind the LazyHdfDict.
- property group#
Root group of the LazyHdfDict.