Loop through list of cells and piece them together one by one

    Parameters
    ----------
    cells : list of dashtable.data2rst.Cell

    Returns
    -------
    grid_table : str
        The final grid table
422125
def merge_all_cells(cells):
    
    current = 0

    while len(cells) > 1:
        count = 0

        while count < len(cells):
            cell1 = cells[current]
            cell2 = cells[count]

            merge_direction = get_merge_direction(cell1, cell2)
            if not merge_direction == "NONE":
                merge_cells(cell1, cell2, merge_direction)

                if current > count:
                    current -= 1

                cells.pop(count)

            else:
                count += 1

        current += 1

        if current >= len(cells):
            current = 0

    return cells[0].text
964776
def getcellslice(self, rownr, blc, trc, inc=[]):
        """"""
        return self._table.getcellslice(self._column, rownr, blc, trc, inc)
60726
def separator(self):
        
        cells = dict([(column, "-" * self.column_widths[column]) for column in self.columns])
        return ColorRow(self, **cells)
655456
def format_row(self, row):
        
        assert all(isinstance(x, VTMLBuffer) for x in row)
        raw = (fn(x) for x, fn in zip(row, self.formatters))
        for line in itertools.zip_longest(*raw):
            line = list(line)
            for i, col in enumerate(line):
                if col is None:
                    line[i] = self._get_blank_cell(i)
            yield line
772052
def process_cell(self, row, column, cell):
        
        value, field = self.parse_cell(cell)

        if value or field:
            return {'col':column, 'field':field, 'value':value}
        else:
            return {}
437652
def insert_cells(cells, pos_dict, ft_name, append=False):
    ""
    idx = get_insert_idx(pos_dict, ft_name)
    if append or idx == -1: cells += [get_doc_cell(ft_name), get_empty_cell()]
    else:
        cells.insert(idx, get_doc_cell(ft_name))
        cells.insert(idx+1, get_empty_cell())
        pos_dict = update_pos(pos_dict, ft_name, 2)
    return cells, pos_dict
1251516
def make_grid(rect, cells={}, num_rows=0, num_cols=0, padding=None,
        inner_padding=None, outer_padding=None, row_heights={}, col_widths={}, 
        default_row_height='expand', default_col_width='expand'):
    
    grid = Grid(
            bounding_rect=rect,
            min_cell_rects=cells,
            num_rows=num_rows,
            num_cols=num_cols,
            padding=padding,
            inner_padding=inner_padding,
            outer_padding=outer_padding,
            row_heights=row_heights,
            col_widths=col_widths,
            default_row_height=default_row_height,
            default_col_width=default_col_width,
    )
    return grid.make_cells()
1161980
def [](cell_def)
      return rows[cell_def] if cell_def.is_a?(Integer)
      parts = cell_def.split(':').map{ |part| name_to_cell part }
      if parts.size == 1
        parts.first
      else
        range(*parts)
      end
    end
644595
def _should_split_column_cells(cls, column_cells: List[str]) -> bool:
        
        return any(cls._should_split_cell(cell_text) for cell_text in column_cells)
16309
def partition(list_, columns=2):
    

    iter_ = iter(list_)
    columns = int(columns)
    rows = []

    while True:
        row = []
        for column_number in range(1, columns + 1):
            try:
                value = six.next(iter_)
            except StopIteration:
                pass
            else:
                row.append(value)

        if not row:
            return rows
        rows.append(row)
996417
def _associate_data_cells_with_header_cells_of_row(self, element):
        

        table = self._get_model_table(element)
        for row in table:
            headers_ids = []
            for cell in row:
                if cell.get_tag_name() == 'TH':
                    self.id_generator.generate_id(cell)
                    headers_ids.append(cell.get_attribute('id'))

                    cell.set_attribute('scope', 'row')
            if bool(headers_ids):
                for cell in row:
                    if cell.get_tag_name() == 'TD':
                        headers = cell.get_attribute('headers')
                        for header_id in headers_ids:
                            headers = CommonFunctions.increase_in_list(
                                headers,
                                header_id
                            )
                        cell.set_attribute('headers', headers)
519980
def print_table(table):
    
    table = [[str(cell) for cell in row] for row in table]
    column_widths = [len(cell) for cell in table[0]]
    for row in table:
        for x, cell in enumerate(row):
            column_widths[x] = max(column_widths[x], len(cell))

    formatters = []
    for width in column_widths:
        formatters.append('{:>' + str(width) + '}')
    formatter = '  '.join(formatters)
    for row in table:
        print(formatter.format(*row))
820693
function getCellsAtColumn(
    opts: Options,
    // The table
    table: Block,
    columnIndex: number
): List<Block> {
    return table.nodes.map(row => row.nodes.get(columnIndex));
}
265682
def cell(*names)
      # define variables
      names_list = names.first.to_s.start_with?('Lato') ? names[1..-1] : names
      cell_class = names.first.to_s.start_with?('Lato') ? "#{names.first}::" : 'LatoCore::'
      # return correct cell
      names_list.each do |name|
        cell_class = "#{cell_class}#{name.capitalize}::"
      end
      "#{cell_class}Cell".constantize
    end
817081
def get_last_filled_cell(self, table=None):
        

        maxrow = 0
        maxcol = 0

        for row, col, tab in self.dict_grid:
            if table is None or tab == table:
                maxrow = max(row, maxrow)
                maxcol = max(col, maxcol)

        return maxrow, maxcol, table
72838
def cells(*args)
      cells = TableCellCollection.new(self, extract_selector(args).merge(:tag_name => /^(th|td)$/))
      cells.locator_class = ChildCellLocator

      cells
    end
524205
def flatten_array(grid):
    
    grid = [grid[i][j] for i in range(len(grid)) for j in range(len(grid[i]))]
    while type(grid[0]) is list:
        grid = flatten_array(grid)
    return grid