blob: 309372459348a51b98d0a384d530751e2003de60 [file] [log] [blame] [edit]
# Copyright 2018 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from cros.factory.probe.lib import combination_function
class Concat(combination_function.AbstractCombinationFunction):
"""Returns the concatenation of output.
Description
-----------
Concat the outputs of the functions.
The type of all the outputs of functions must be a list.
The concept is::
res = []
res.extend(Func1(data))
res.extend(Func2(data))
...
"""
def Combine(self, functions, data):
res = []
for func in functions:
ret = func(data)
if not isinstance(ret, list):
raise TypeError
res.extend(ret)
return res