diff options
author | David Aguilar <davvid@gmail.com> | 2008-05-29 01:50:55 -0700 |
---|---|---|
committer | David Aguilar <davvid@gmail.com> | 2008-05-29 01:50:55 -0700 |
commit | 8501e908bb8c531dfa75cef33fcec519027f4e5b (patch) | |
tree | 05983d2952787cf220e7b5cce47b738fbfedf438 /lib/git_python | |
parent | a7129dc00826cb344c0202f152f1be33ea9326fe (diff) | |
download | gitpython-8501e908bb8c531dfa75cef33fcec519027f4e5b.tar.gz |
utils: add a pop_key helper function
pop_key removes a value from a dictionary and it in one step.
This function will be used in the next integration.
Signed-off-by: David Aguilar <davvid@gmail.com>
Diffstat (limited to 'lib/git_python')
-rw-r--r-- | lib/git_python/utils.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/git_python/utils.py b/lib/git_python/utils.py index c2140ba0..f367c3e2 100644 --- a/lib/git_python/utils.py +++ b/lib/git_python/utils.py @@ -3,3 +3,9 @@ def dashify(string): def touch(filename): open(filename, "a").close() + +def pop_key(d, key): + value = d.get(key, None) + if key in d: + del d[key] + return value |