ch5mpy.H5Dict
- class ch5mpy.H5Dict(file, annotation=None)[source]
Class for managing dictionaries backed on h5 files.
Attributes
Is the file (this H5 object wraps) closed ?
Methods
Close the file this H5 object wraps.
Build an in-memory copy of this H5Dict object.
- rtype:
- rtype:
H5DictItemsView[TypeVar(_T)]
If key is not found, d is returned if given, otherwise KeyError is raised.
as a 2-tuple; but raise KeyError if D is empty.
Read an H5 object from a file.
- rtype:
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
- rtype:
H5DictValuesView[TypeVar(_T)]
Attributes
Methods
- H5Dict.clear() None. Remove all items from D.
- H5Dict.pop(k[, d]) v, remove specified key and return the corresponding value.
If key is not found, d is returned if given, otherwise KeyError is raised.
- H5Dict.popitem() (k, v), remove and return some (key, value) pair
as a 2-tuple; but raise KeyError if D is empty.
- classmethod H5Dict.read(path, name=None, mode=H5Mode.READ)[source]
Read an H5 object from a file.
- Parameters:
path (
str|Path|File|Group) – Either a path to the .h5 file or an open ch5mpy.File or ch5mpy.Group object.name (
Optional[str] (default:None)) – The group member name inside the .h5 file to use.mode (
H5Mode(default:<H5Mode.READ: 'r'>)) – The mode for opening the .h5 file if not already open.- Return type:
- H5Dict.setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D
- H5Dict.update([E, ]**F) None. Update D from mapping/iterable E and 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