navigate.tools.common_dict_tools.update_nested_dict
- navigate.tools.common_dict_tools.update_nested_dict(d, find_func, apply_func)
Update a nested dictionary by applying a function to a value
Loops through a nested dictionary and if find_func() conditions are met, run apply_func on that key.
TODO: It might be nice to make this non-recursive.
- Parameters:
d (dict) – Dictionary to be updated
find_func (func) – Accepts key, value pair and matches a condition based on these. Returns bool.
apply_func (func) – Accepts a value returns the new value.
- Returns:
d2 – An version of d, updated according to the passed functions.
- Return type:
dict