From dd7bf5f04371227bcef641223ab3d793b59125f0 Mon Sep 17 00:00:00 2001 From: txjacob Date: Wed, 17 Jun 2020 12:58:14 -0500 Subject: [PATCH] Change method of checking if a key is in the dictionary. The original method would return false if the key contained the boolean "false" causing the value not to be deleted even if it existed. --- nested_lookup/lookup_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nested_lookup/lookup_api.py b/nested_lookup/lookup_api.py index a0af63a..3487670 100644 --- a/nested_lookup/lookup_api.py +++ b/nested_lookup/lookup_api.py @@ -24,7 +24,7 @@ def _nested_delete(document, key): for list_items in document: _nested_delete(document=list_items, key=key) elif isinstance(document, dict): - if document.get(key): + if key in document: del document[key] for dict_key, dict_value in iteritems(document): _nested_delete(document=dict_value, key=key)