MCPcopy Create free account
hub / github.com/astanin/python-tabulate / _append_multiline_row

Function _append_multiline_row

tabulate/__init__.py:2601–2620  ·  view source on GitHub ↗
(
    lines, padded_multiline_cells, padded_widths, colaligns, rowfmt, pad, rowalign=None
)

Source from the content-addressed store, hash-verified

2599
2600
2601def _append_multiline_row(
2602 lines, padded_multiline_cells, padded_widths, colaligns, rowfmt, pad, rowalign=None
2603):
2604 colwidths = [w - 2 * pad for w in padded_widths]
2605 cells_lines = [c.splitlines() for c in padded_multiline_cells]
2606 nlines = max(map(len, cells_lines)) # number of lines in the row
2607 # vertically pad cells where some lines are missing
2608 # cells_lines = [
2609 # (cl + [" " * w] * (nlines - len(cl))) for cl, w in zip(cells_lines, colwidths)
2610 # ]
2611
2612 cells_lines = [
2613 _align_cell_veritically(cl, nlines, w, rowalign)
2614 for cl, w in zip(cells_lines, colwidths)
2615 ]
2616 lines_cells = [[cl[i] for cl in cells_lines] for i in range(nlines)]
2617 for ln in lines_cells:
2618 padded_ln = _pad_row(ln, pad)
2619 _append_basic_row(lines, padded_ln, colwidths, colaligns, rowfmt)
2620 return lines
2621
2622
2623def _build_line(colwidths, colaligns, linefmt):

Callers

nothing calls this directly

Calls 3

_align_cell_veriticallyFunction · 0.85
_pad_rowFunction · 0.85
_append_basic_rowFunction · 0.85

Tested by

no test coverage detected