Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/h5json' into h5json
Browse files Browse the repository at this point in the history
# Conflicts:
#	pyiron_base/storage/helper_functions.py
  • Loading branch information
jan-janssen committed Dec 20, 2023
2 parents bcfe1b8 + 66724f4 commit a22d4b6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pyiron_base/storage/helper_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,16 @@ def get_dict_from_nodes(store, h5_path, slash="ignore"):
}

def resolve_nested_dict(group_path, data_dict):
"""
Turns a dict with a key containing slashes into a nested dict. {'/a/b/c': 1} -> {'a': {'b': {'c': 1}
Args:
group_path (str): path inside the HDF5 file the data_dictionary was loaded from
data_dict (dict): dictionary with data loaded from the HDF5 file
Returns:
dict: hierarchical dictionary
"""
groups = group_path.split("/")
nested_dict = data_dict
for g in groups[::-1]:
Expand Down

0 comments on commit a22d4b6

Please sign in to comment.