INNER CODE UNIT · Python

list_subtract

weaveworks/kubediff · kubedifflib/_diff.py:108

def list_subtract(xs, ys, equality=operator.eq):
    """Return items in 'xs' but not in 'ys'."""
    matched = set()
    for i, x in enumerate(xs):
        for j, y in enumerate(ys):
            if j in matched:
                continue
            if equality(x, y):
                matched.add(j)
                break
        else:
            yield i


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

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…