Skip to content

Commit

Permalink
PEP8 fixes
Browse files Browse the repository at this point in the history
Also collapses `or` chains on the `isinstance` call to a tuple check
  • Loading branch information
Outfenneced committed Apr 1, 2019
1 parent 477e9a8 commit 4304042
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion flatten_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def _flatten(object_, key):
_flatten(object_[object_key], _construct_key(key,
separator,
object_key))
elif isinstance(object_, list) or isinstance(object_, set) or isinstance(object_, tuple):
elif isinstance(object_, (list, set, tuple)):
for index, item in enumerate(object_):
_flatten(item, _construct_key(key, separator, index))
# Anything left take as is
Expand Down
2 changes: 1 addition & 1 deletion test_flatten.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def test_empty_list_and_dict(self):
'e_0_g_0_j': '', 'e_0_g_0_k': None}
actual = flatten(dic)
self.assertEqual(actual, expected)

def test_tuple(self):
dic = {
'a': 1,
Expand Down

0 comments on commit 4304042

Please sign in to comment.