blob: 1aa73e51185555fa120b8586c2bfb9b44d50c753 [file] [log] [blame]
# Copyright 2018 The Chromium OS Authors. All rights reserved.
# 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.CombinationFunction):
"""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