Format each row of the table.
487024
def build_table(self, msg):
        """"""
        rows = msg.split('\n')
        if rows:
            header_row, *body_rows = rows
            self.create_md_row(header_row, True)
            for row in body_rows:
                self.create_md_row(row)
1088316
public function format_row($row) {
        if ($this->rownum < 0) {
            $this->rownum = $this->currpage * $this->pagesize;
        } else {
            $this->rownum += 1;
        }

        return parent::format_row($row);
    }
137796
def _render_corpus_row(self, label, ngrams):
        """"""
        row = ('<tr>\n<td>{label}</td>\n<td>{first}</td>\n<td>{only}</td>\n'
               '<td>{last}</td>\n</tr>')
        cell_data = {'label': label}
        for period in ('first', 'only', 'last'):
            cell_data[period] = ', '.join(ngrams[label][period])
        return row.format(**cell_data)
820305
def format_column(self, label, column):
        """"""
        if len(column) == 0:
            val_width = 0
        else:
            val_width = max(len(self.format_value(v)) for v in column)
        val_width = min(val_width, self.max_width)
        width = max(val_width, len(str(label)), self.min_width, len(self.etc))
        def pad(value, label=False):
            if label:
                raw = value
            else:
                raw = self.format_value(value)
            if len(raw) > width:
                prefix = raw[:width-len(self.etc)] + self.etc
            else:
                prefix = raw
            return prefix.ljust(width)
        return pad
733385
def std_table(rows):
    """"""

    result = ""
    if len(rows) > 1:
        headers = rows[0]._fields
        lens = []
        for i in range(len(rows[0])):
            lens.append(len(max([x[i] for x in rows] + [headers[i]],
                                key=lambda x: len(str(x)))))
        formats = []
        hformats = []
        for i in range(len(rows[0])):
            if isinstance(rows[0][i], int):
                formats.append("%%%dd" % lens[i])
            else:
                formats.append("%%-%ds" % lens[i])
            hformats.append("%%-%ds" % lens[i])
        pattern = " | ".join(formats)
        hpattern = " | ".join(hformats)
        separator = "-+-".join(['-' * n for n in lens])
        result += hpattern % tuple(headers) + " \n"
        result += separator + "\n"

        for line in rows:
            result += pattern % tuple(t for t in line) + "\n"
    elif len(rows) == 1:
        row = rows[0]
        hwidth = len(max(row._fields, key=lambda x: len(x)))
        for i in range(len(row)):
            result += "%*s = %s" % (hwidth, row._fields[i], row[i]) + "\n"

    return result
1125431
def format_prettytable(table):
    """"""
    for i, row in enumerate(table.rows):
        for j, item in enumerate(row):
            table.rows[i][j] = format_output(item)

    ptable = table.prettytable()
    ptable.hrules = prettytable.FRAME
    ptable.horizontal_char = '.'
    ptable.vertical_char = ':'
    ptable.junction_char = ':'
    return ptable
653382
def pprint_table(table):
    
    col_paddings = []
    for i in range(len(table[0])):
        col_paddings.append(get_max_width(table,i))
    for row in table:
        print(row[0].ljust(col_paddings[0] + 1), end="")
        for i in range(1, len(row)):
            col = str(row[i]).rjust(col_paddings[i]+2)
            print(col, end='')
        print("\n")
661978
def run(self, lines):
        """"""
        ret = []

        for block in self.blocks(lines):
            ret.extend(self.convert_table(block))

        return ret
1327758
def each
      (1..ROWS).each do |r|
        (1..COLS).each do |c|
          yield(r, c, self[r, c])
        end
      end
    end
1088704
function TableFormatter(options) {
  const table = new Table(options);
  this.format = format;
  function format(result, formatOptions) {
    let data = [];
    _.each(result, function (item) {
      data.push(_.values(_.pick(item, options.values)));
    });
    if (formatOptions.format === 'csv') {
     _.each(data, function(row) {
       console.log(row.join(','));
     });
    } else if ( formatOptions.format === 'json') {
      console.log(JSON.stringify(result));
    } else {
      table.push.apply(table, data);
      console.log(table.toString());
    }
  }
}
910838
def format_dimension(dimension):
        """"""
        result = ""
        if "type" in dimension.attrib:
            result += "[R" if dimension.attrib["type"] == "row" else "[C"
        else:
            result += "[C"
        if "index" in dimension.attrib:
            result += ":" + dimension.attrib["index"]

        result += "] " + re.sub("\s+", " ", dimension.text.replace("\n", " "))
        return result
205804
public function formatRow()
    {
        parent::formatRow();

        $page = $this->model['page'];

        if (!$page && $this->max_depth) {
            // by default resort to parent pages
            $tmp = array();
            for ($i = 0; $i < $this->max_depth; ++$i) {
                $tmp[] = '..';
            }
            --$this->max_depth;

            $page = $this->app->url(implode('/', $tmp));
        }

        if ($page) {
            $this->current_row_html['crumb'] = '<a href="'.$this->app->url($page).'">'.
                htmlspecialchars($this->model['name']).
                '</a>';
        } else {
            $this->current_row_html['crumb'] = htmlspecialchars($this->model['name']);
        }
    }
496735
def pretty_format_row(self, row, filler=" ", splitter="|"):
        
        return self.get_pretty_row(
            row,
            filler,
            splitter
        )
866032
def __print_table(table):
        """"""

        col_width = [max(len(x) for x in col) for col in zip(*table)]
        print("| " + " | ".join("{:{}}".format(x, col_width[i])
                                for i, x in enumerate(table[0])) + " |")
        print("| " + " | ".join("{:{}}".format('-' * col_width[i], col_width[i])
                                for i, x in enumerate(table[0])) + " |")
        for line in table[1:]:
            print("| " + " | ".join("{:{}}".format(x, col_width[i])
                                    for i, x in enumerate(line)) + " |")
82195
def iter_to_table(value):
    """"""
    if isinstance(value, list):
        return _format_list(value)
    if isinstance(value, dict):
        return _format_dict(value)
    return value
650572
def _format_row(row, colnames, tab):
    
    out=""

    out+="\n<tr>"
    for colname in colnames:
        out+="<td style='vertical-align:top; white-space:pre'>"
        out+=_format_cell(row[colname], tab.getcolkeywords(colname))
        out+="</td>\n"
    out+="</tr>\n"
    return out
761636
def tablify(*args):
    
    """
    table = []
    args = [listify(arg) for arg in args]
    for row in zip(*args):
        r = []
        for x in row:
            r += listify(x)
        table += [r]
    return table
    return [sum([listify(el) for el in row]) for row in zip(*args)]