From 8501e908bb8c531dfa75cef33fcec519027f4e5b Mon Sep 17 00:00:00 2001 From: David Aguilar Date: Thu, 29 May 2008 01:50:55 -0700 Subject: 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 --- lib/git_python/utils.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/git_python') 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 -- cgit v1.2.1