Fix for issue #17 (#18)

* Fix for issue #17
* Updating version (and) Adding Travis CI support
* Adding Build status to README
This commit is contained in:
Ramesh RV 2019-03-04 19:14:32 +05:30 committed by Russell Ballestrini
parent 8c4229944f
commit 0e8723b822
7 changed files with 128 additions and 27 deletions

View file

@ -22,7 +22,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 document.get(key) is not None:
del document[key]
for dict_key, dict_value in iteritems(document):
_nested_delete(document=dict_value, key=key)
@ -49,7 +49,7 @@ def _nested_update(document, key, value):
for list_items in document:
_nested_update(document=list_items, key=key, value=value)
elif isinstance(document, dict):
if document.get(key):
if document.get(key) is not None:
document[key] = value
for dict_key, dict_value in iteritems(document):
_nested_update(document=dict_value, key=key, value=value)

View file

@ -113,9 +113,10 @@ def _get_occurrence(dictionary, item, keyword):
def recrusion(dictionary):
if item == 'key':
occurrence[0] += 1 if dictionary.get(keyword) else 0
elif keyword in dictionary.values():
occurrence[0] += dictionary.values().count(keyword)
if dictionary.get(keyword) is not None:
occurrence[0] += 1
elif keyword in list(dictionary.values()):
occurrence[0] += list(dictionary.values()).count(keyword)
for key, value in iteritems(dictionary):
if isinstance(value, dict):
recrusion(dictionary=value)