Skip to content

Commit 875047b

Browse files
committed
Reverted ListOperations.spread method to previous (I think) implementation.
The itertools way had the tests broken, and has been commented out for now.
1 parent 081534e commit 875047b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

pyhdtoolkit/utils/operations.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,14 @@ def spread(arg: list) -> list:
190190
Example:
191191
ListOperations.spread([list(range(5)), list(range(5))]) -> [0, 1, 2, 3, 4, 0, 1, 2, 3, 4]
192192
"""
193-
return list(itertools.chain.from_iterable(arg))
193+
# return list(itertools.chain.from_iterable(arg))
194+
ret = []
195+
for i in arg:
196+
if isinstance(i, list):
197+
ret.extend(i)
198+
else:
199+
ret.append(i)
200+
return ret
194201

195202
@staticmethod
196203
def symmetric_difference_by(lst_1: list, lst_2: list, function) -> list:

0 commit comments

Comments
 (0)