Skip to content

Commit

Permalink
update flatten: improve readability]
Browse files Browse the repository at this point in the history
  • Loading branch information
FelipeSBarros committed Feb 15, 2024
1 parent 30ca32a commit 9c1c368
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crossfire/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ def flatten(data, nested_columns=None):
nested_columns = set(nested_columns or NESTED_COLUMNS)
if not nested_columns.issubset(NESTED_COLUMNS):
raise NestedColumnError(nested_columns)
if not data:
return data
if isinstance(data, list):
if not data:
return data
keys = set(data[0].keys()) & nested_columns
for item in data:
for key in keys:
Expand Down

0 comments on commit 9c1c368

Please # to comment.