Skip to content

Commit

Permalink
fix error when extrakeys lookup non-dicts
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl committed Feb 18, 2019
1 parent abc61fb commit 91f2f6d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion nbstripout.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,12 @@ def pop_recursive(d, key, default=None):
nested = key.split('.')
current = d
for k in nested[:-1]:
current = current.get(k, {})
if hasattr(current, 'get'):
current = current.get(k, {})
else:
return default
if not hasattr(current, 'pop'):
return default
return current.pop(nested[-1], default)


Expand Down

0 comments on commit 91f2f6d

Please sign in to comment.