Sets table, with column headers and separators.
324567
def _SetTable(self, table):
    """"""
    if not isinstance(table, TextTable):
      raise TypeError('Not an instance of TextTable.')
    self.Reset()
    self._table = copy.deepcopy(table._table)   # pylint: disable=W0212
    # Point parent table of each row back ourselves.
    for row in self:
      row.table = self
195203
def setCol(self, x, l):
        """"""
        for i in xrange(0, self.__size):
            self.setCell(x, i, l[i])
156389
public function setup_table() {
        /*
         * Table has 3 columns
         *| course  | final grade | rank (optional) |
         */

        // setting up table headers
        if ($this->showrank['any']) {
            $tablecolumns = array('coursename', 'grade', 'rank');
            $tableheaders = array($this->get_lang_string('coursename', 'grades'),
                                  $this->get_lang_string('grade'),
                                  $this->get_lang_string('rank', 'grades'));
        } else {
            $tablecolumns = array('coursename', 'grade');
            $tableheaders = array($this->get_lang_string('coursename', 'grades'),
                                  $this->get_lang_string('grade'));
        }
        $this->table = new flexible_table('grade-report-overview-'.$this->user->id);

        $this->table->define_columns($tablecolumns);
        $this->table->define_headers($tableheaders);
        $this->table->define_baseurl($this->baseurl);

        $this->table->set_attribute('cellspacing', '0');
        $this->table->set_attribute('id', 'overview-grade');
        $this->table->set_attribute('class', 'boxaligncenter generaltable');

        $this->table->setup();
    }
1047967
def AddTableColumns(self, table, columns):
    """"""
    table_columns = self._table_columns.setdefault(table, [])
    for attr in columns:
      if attr not in table_columns:
        table_columns.append(attr)
593185
def make_table(file_dict):
        """"""
        col_key = Column(name='key', dtype=int)
        col_path = Column(name='path', dtype='S256')
        col_creator = Column(name='creator', dtype=int)
        col_timestamp = Column(name='timestamp', dtype=int)
        col_status = Column(name='status', dtype=int)
        col_flags = Column(name='flags', dtype=int)
        columns = [col_key, col_path, col_creator,
                   col_timestamp, col_status, col_flags]
        table = Table(data=columns)
        for val in file_dict.values():
            val.append_to_table(table)
        return table
398771
def mk_set_headers(self, data, columns):
        
        columns = tuple(columns)
        lens = []

        for key in columns:
            value_len = max(len(str(each.get(key, ''))) for each in data)
            # account for header lengths
            lens.append(max(value_len, len(self._get_name(key))))

        fmt = self.mk_fmt(*lens)
        return fmt
1021728
def prepare_rows(self,
                     rows,
                     indent,
                     has_header):

        ''''''

        out = []

        def row_wrapper(row):
            new_rows = [
                self.wrapfunc(item).split('\n')
                for item in row
            ]
            rows = []
            for item in map(lambda *args: args, *new_rows):
                if isinstance(item, (tuple, list)):
                    rows.append([substr or '' for substr in item])
                else:
                    rows.append([item])
            return rows

        logical_rows = [
            row_wrapper(row)
            for row in rows
        ]

        columns = map(lambda *args: args, *reduce(operator.add, logical_rows))

        max_widths = [
            max([len(six.text_type(item)) for item in column])
            for column in columns
        ]
        row_separator = self.row_delimiter * (len(self.prefix) + len(self.suffix) + sum(max_widths) +
                                              len(self.delim) * (len(max_widths) - 1))

        justify = self._JUSTIFY_MAP[self.justify.lower()]

        if self.separate_rows:
            out.append(
                self.ustring(
                    indent,
                    self.LIGHT_GRAY,  # pylint: disable=no-member
                    row_separator
                )
            )
        for physical_rows in logical_rows:
            for row in physical_rows:
                line = self.prefix \
                        + self.delim.join([
                                justify(six.text_type(item), width)
                                for (item, width) in zip(row, max_widths)
                        ]) + self.suffix
                out.append(
                    self.ustring(
                        indent,
                        self.WHITE,  # pylint: disable=no-member
                        line
                    )
                )
            if self.separate_rows or has_header:
                out.append(
                    self.ustring(
                        indent,
                        self.LIGHT_GRAY,  # pylint: disable=no-member
                        row_separator
                    )
                )
                has_header = False
        return out
1083419
def set(self, header, value=None):
        """"""
        if value is None:
            for k, v in header.items():
                self.headers[k] = v
        else:
            self.headers[header] = value
1208026
def tabulate(data, header=True, headers=None, accessors=None,
             **table_options):
    
    if header and not headers:
        data = iter(data)
        try:
            headers = next(data)
        except StopIteration:
            pass
    if headers and hasattr(headers, 'items') and accessors is None:
        # Dict mode; Build accessors and headers from keys of data.
        data = itertools.chain([headers], data)
        accessors = list(headers)
        headers = [' '.join(map(str.capitalize, x.replace('_', ' ').split()))
                   for x in accessors]
    t = Table(headers=headers, accessors=accessors, **table_options)
    try:
        t.print(data)
    except RowsNotFound:
        pass
    return t
1207012
public void setTables(final List<Table> tables) {
        this.tablesMap.clear();
        for (final Table table : tables)
            this.addTableConfig(table.getConfigEntry());
    }
996239
def setup_columns(self):
        """"""
        tv = self.view['tv_categories']

        # sets the model
        tv.set_model(self.model)
        
        # creates the columns
        cell = gtk.CellRendererText()
        tvcol = gtk.TreeViewColumn('Name', cell)

        def cell_data_func(col, cell, mod, it):
            if mod[it][0]: cell.set_property('text', mod[it][0].name)
            return
        tvcol.set_cell_data_func(cell, cell_data_func)
        
        tv.append_column(tvcol)                
        return
727935
def putcol(self, value, startrow=0, nrow=-1, rowincr=1):
        """"""
        return self._table.putcol(self._column, value, startrow, nrow, rowincr)
732445
def setColumn(self, header, values):
        
        if any(isinstance(value, basestring) for value in values):
            values = list(map(str, values))
            self._impl.setColumnStr(header, values, len(values))
        elif all(isinstance(value, Real) for value in values):
            values = list(map(float, values))
            self._impl.setColumnDbl(header, values, len(values))
        else:
            print(values)
            raise NotImplementedError
917962
def begin_table(self, column_count):
        """"""
        self.table_columns = column_count
        self.table_columns_left = 0
        self.write('<table>')
1363281
def _format_table(fmt, headers, rows, colwidths, colaligns):
    """"""
    lines = []
    hidden = fmt.with_header_hide if (headers and fmt.with_header_hide) else []
    pad = fmt.padding
    headerrow = fmt.headerrow

    padded_widths = [(w + 2*pad) for w in colwidths]
    padded_headers = _pad_row(headers, pad)
    padded_rows = [_pad_row(row, pad) for row in rows]

    if fmt.lineabove and "lineabove" not in hidden:
        lines.append(_build_line(padded_widths, colaligns, fmt.lineabove))

    if padded_headers:
        lines.append(_build_row(padded_headers, padded_widths, colaligns, headerrow))
        if fmt.linebelowheader and "linebelowheader" not in hidden:
            lines.append(_build_line(padded_widths, colaligns, fmt.linebelowheader))

    if padded_rows and fmt.linebetweenrows and "linebetweenrows" not in hidden:
        # initial rows with a line below
        for row in padded_rows[:-1]:
            lines.append(_build_row(row, padded_widths, colaligns, fmt.datarow))
            lines.append(_build_line(padded_widths, colaligns, fmt.linebetweenrows))
        # the last row without a line below
        lines.append(_build_row(padded_rows[-1], padded_widths, colaligns, fmt.datarow))
    else:
        for row in padded_rows:
            lines.append(_build_row(row, padded_widths, colaligns, fmt.datarow))

    if fmt.linebelow and "linebelow" not in hidden:
        lines.append(_build_line(padded_widths, colaligns, fmt.linebelow))

    return "\n".join(lines)
931232
public function setHeader(array $header_cols){
      $this->header = new TableHeader($header_cols);

      $this->updateMaxRowLength($this->header);
   }
461307
def putcolslice(self, value, blc, trc, inc=[], startrow=0, nrow=-1, rowincr=1):
        """"""
        return self._table.putcolslice(self._column, value, blc, trc, inc, startrow, nrow, rowincr)