torch_ecg.utils.dict_to_str

torch_ecg.utils.dict_to_str(d: dict | list | tuple, current_depth: int = 1, indent_spaces: int = 4) str[source]

Convert a (possibly) nested dict into a str of json-like formatted form.

This nested dict might also contain lists or tuples of dict (and of str, int, etc.)

Parameters:
  • d (dict or list or tuple) – A (possibly) nested dict, or a list of dict.

  • current_depth (int, default 1) – Depth of d in the (possible) parent dict or list.

  • indent_spaces (int, default 4) – The indent spaces of each depth.

Returns:

The formatted string.

Return type:

str