operations
debug_dict(in_dict=None)
Debug print a dict by looping overkeys and printing.
If type of key is also dict, re-run the loop on that key and continue.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
in_dict |
dict
|
The input dict to loop & debug print |
None
|
Raises
Exception: A generic `Exception` whenever debug printing a `dict` fails
Source code in src/red_utils/std/dict_utils/operations.py
merge_dicts(original_dict=None, update_vals=None)
Merge dicts into new dict.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
original_dict |
dict
|
The first |
None
|
update_vals |
dict
|
The new |
None
|
Returns
(dict): A merged `dict` from the 2 input `dict`s
Raises
Exception: When merging the `dict`s fails
Source code in src/red_utils/std/dict_utils/operations.py
update_dict(original_dict=None, update_vals=None)
Update a dict with values from a second dict.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
original_dict |
dict[str, Any]
|
The original dictionary to be updated. |
None
|
update_vals |
dict[str, Any]
|
The dict with values with which to update the original dict. |
None
|
Returns
(dict): A `dict` with updated values