diff options
Diffstat (limited to 'github3/helpers.py')
-rw-r--r-- | github3/helpers.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/github3/helpers.py b/github3/helpers.py index 91b4be5..1f9e713 100644 --- a/github3/helpers.py +++ b/github3/helpers.py @@ -25,6 +25,23 @@ def is_collection(obj): return val +def key_diff(source, update): + """Given two dictionaries, returns a list of the changed keys.""" + + source = dict(source) + update = dict(update) + + changed = [] + + for (k, v) in source.items(): + u_v = update.get(k) + + if (v != u_v) and (u_v is not None): + changed.append(k) + + return changed + + # from arc90/python-readability-api def to_python(obj, in_dict, |