INNER CODE UNIT · Python

diff_dicts

weaveworks/kubediff · kubedifflib/_diff.py:122

def diff_dicts(path, want, have):
    for (k, want_v) in viewitems(want):
        key_path = "%s.%s" % (path, k)

        if k not in have:
            yield missing_item(path, k)
        else:
            for difference in diff(key_path, want_v, have[k]):
                yield difference


def normalize(value):
    if isinstance(value, numbers.Number):
        return str(value)
    if value == [] or value == {}:
        return None
    return value

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…