Skip to content

Commit 8501e90

Browse files
committed
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>
1 parent a7129dc commit 8501e90

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/git_python/utils.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,9 @@ def dashify(string):
33

44
def touch(filename):
55
open(filename, "a").close()
6+
7+
def pop_key(d, key):
8+
value = d.get(key, None)
9+
if key in d:
10+
del d[key]
11+
return value

0 commit comments

Comments
 (0)