aboutsummaryrefslogtreecommitdiffstats
path: root/github3/helpers.py
diff options
context:
space:
mode:
authorKenneth Reitz <me@kennethreitz.com>2011-10-18 22:48:38 -0400
committerKenneth Reitz <me@kennethreitz.com>2011-10-18 22:48:38 -0400
commit9af936fa8f794282a7a8a699bf3b3e807d9efe79 (patch)
treed82ef30c271c67417db1c33bce1bb7f644d843ae /github3/helpers.py
parentI guess api tokens are deprecated now :( (diff)
downloadpython-github3-9af936fa8f794282a7a8a699bf3b3e807d9efe79.tar.xz
python-github3-9af936fa8f794282a7a8a699bf3b3e807d9efe79.zip
key_differ
Diffstat (limited to 'github3/helpers.py')
-rw-r--r--github3/helpers.py17
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,