/usr/share/pyshared/landscape/diff.py is in landscape-common 12.04.3-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | def diff(old, new):
"""Returns the set of differences between two C{dict}s.
@return: A 3-tuple of dicts with the changes that would need to be
made to convert C{old} into C{new}: C{(creates, updates, deletes)}
"""
new_keys = set(new.iterkeys())
old_keys = set(old.iterkeys())
creates = {}
for key in new_keys - old_keys:
creates[key] = new[key]
updates = {}
for key in old_keys & new_keys:
if old[key] != new[key]:
updates[key] = new[key]
deletes = {}
for key in old_keys - new_keys:
deletes[key] = old[key]
return creates, updates, deletes
|