cfitall.utils

This module is full of little recursive functions that help with converting string-path notations into nested dicts, and vice versa. A string-path, or “flattened” dict might look like this:

{‘foo.bar.bat’: ‘asdfhjklkjhfdsa’}

As an “expanded” or “nested” dict, the same data would be:

{‘foo’: {‘bar’: {‘bat’: ‘lkjhgfdsasdfghjkl’}}}

Functions

add_keys

Nests keys from srclist into destdict, with optional value set on the final key.

expand_flattened_dict

Expands a flattened dict into a nested dict, e.g.

expand_flattened_path

Expands a dotted path into a nested dict; if value is set, the final key in the path will be set to value.

flatten_dict

Flattens a deeply nested dictionary into a flattened dictionary.

merge_dicts

Performs a deep merge of two nested dicts by expanding all Mapping objects until they reach a non-mapping value (e.g.