

def extend(self, table, keys=None):
    'Extends all rows in the texttable.\n\n    The rows are extended with the new columns from the table.\n\n    Args:\n      table: A texttable, the table to extend this table by.\n      keys: A set, the set of columns to use as the key. If None, the\n        row index is used.\n\n    Raises:\n      IndexError: If key is not a valid column name.\n    '
    if keys:
        for k in keys:
            if (k not in self._Header()):
                raise IndexError("Unknown key: '%s'", k)
    extend_with = []
    for column in table.header:
        if (column not in self.header):
            extend_with.append(column)
    if (not extend_with):
        return
    for column in extend_with:
        self.AddColumn(column)
    if (not keys):
        for (row1, row2) in zip(self, table):
            for column in extend_with:
                row1[column] = row2[column]
        return
    for row1 in self:
        for row2 in table:
            for k in keys:
                if (row1[k] != row2[k]):
                    break
            else:
                for column in extend_with:
                    row1[column] = row2[column]
                break

dataset/ETHPy150Open google/textfsm/texttable.py TextTable.extend/original