Skip to content

Commit 9bd3572

Browse files
only flatten lists
and make code a bit more readable (hopefully)
1 parent f4a9739 commit 9bd3572

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

ctdconverter/common/utils.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,14 @@ def parse_input_ctds(xsd_location, input_ctds, output_destination, output_file_e
184184

185185

186186
def flatten_list_of_lists(args, list_name):
187-
setattr(args, list_name, [item for sub_list in getattr(args, list_name) for item in sub_list if isinstance(sub_list, list)])
187+
lst = getattr(args, list_name)
188+
ret = []
189+
for l in lst:
190+
if isinstance(l, list):
191+
ret.extend(l)
192+
else:
193+
ret.append(l)
194+
setattr(args, list_name, ret)
188195

189196

190197
def validate_against_schema(ctd_file, schema):

0 commit comments

Comments
 (0)