ch5mpy.H5Dict

class ch5mpy.H5Dict(file, annotation=None)[source]

Class for managing dictionaries backed on h5 files.

Attributes

H5Dict.attributes

H5Dict.file

H5Dict.filename

H5Dict.is_closed

Is the file (this H5 object wraps) closed ?

H5Dict.mode

H5Dict.name

Methods

H5Dict.__init__

H5Dict.clear

H5Dict.close

Close the file this H5 object wraps.

H5Dict.copy

Build an in-memory copy of this H5Dict object.

H5Dict.get

rtype:

Any

H5Dict.items

rtype:

H5DictItemsView[TypeVar(_T)]

H5Dict.keys

rtype:

KeysView[str]

H5Dict.pop

If key is not found, d is returned if given, otherwise KeyError is raised.

H5Dict.popitem

as a 2-tuple; but raise KeyError if D is empty.

H5Dict.read

Read an H5 object from a file.

H5Dict.rename

rtype:

None

H5Dict.setdefault

H5Dict.update

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

H5Dict.values

rtype:

H5DictValuesView[TypeVar(_T)]

Parameters:

Attributes

H5Dict.attributes
H5Dict.file
H5Dict.filename
H5Dict.is_closed

Is the file (this H5 object wraps) closed ?

H5Dict.mode
H5Dict.name

Methods

H5Dict.__init__(file, annotation=None)[source]
Parameters:
H5Dict.clear() None.  Remove all items from D.
H5Dict.close()

Close the file this H5 object wraps.

Return type:

None

H5Dict.copy()[source]

Build an in-memory copy of this H5Dict object.

Return type:

dict[str, Any]

H5Dict.get(key, default=None)[source]
Return type:

Any

Parameters:
  • key (str) –

  • default (Any | None) –

H5Dict.items()[source]
Return type:

H5DictItemsView[TypeVar(_T)]

H5Dict.keys()[source]
Return type:

KeysView[str]

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[Any]

H5Dict.rename(name, new_name)[source]
Return type:

None

Parameters:
  • name (str) –

  • new_name (str) –

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

H5Dict.values()[source]
Return type:

H5DictValuesView[TypeVar(_T)]