Prints a table of basic user information
485302
def basic_info(user, keys):
    """"""

    table = formatting.KeyValueTable(['Title', 'Basic Information'])
    table.align['Title'] = 'r'
    table.align['Basic Information'] = 'l'

    table.add_row(['Id', user.get('id', '-')])
    table.add_row(['Username', user.get('username', '-')])
    if keys:
        for key in user.get('apiAuthenticationKeys'):
            table.add_row(['APIKEY', key.get('authenticationKey')])
    table.add_row(['Name', "%s %s" % (user.get('firstName', '-'), user.get('lastName', '-'))])
    table.add_row(['Email', user.get('email')])
    table.add_row(['OpenID', user.get('openIdConnectUserName')])
    address = "%s %s %s %s %s %s" % (
        user.get('address1'), user.get('address2'), user.get('city'), user.get('state'),
        user.get('country'), user.get('postalCode'))
    table.add_row(['Address', address])
    table.add_row(['Company', user.get('companyName')])
    table.add_row(['Created', user.get('createDate')])
    table.add_row(['Phone Number', user.get('officePhone')])
    if user.get('parentId', False):
        table.add_row(['Parent User', utils.lookup(user, 'parent', 'username')])
    table.add_row(['Status', utils.lookup(user, 'userStatus', 'name')])
    table.add_row(['PPTP VPN', user.get('pptpVpnAllowedFlag', 'No')])
    table.add_row(['SSL VPN', user.get('sslVpnAllowedFlag', 'No')])
    for login in user.get('unsuccessfulLogins', {}):
        login_string = "%s From: %s" % (login.get('createDate'), login.get('ipAddress'))
        table.add_row(['Last Failed Login', login_string])
        break
    for login in user.get('successfulLogins', {}):
        login_string = "%s From: %s" % (login.get('createDate'), login.get('ipAddress'))
        table.add_row(['Last Login', login_string])
        break

    return table
294753
def show(self):
        
        print("StringBlock(stringsCount=0x%x, "
              "stringsOffset=0x%x, "
              "stylesCount=0x%x, "
              "stylesOffset=0x%x, "
              "flags=0x%x"
              ")" % (self.stringCount,
                     self.stringsOffset,
                     self.styleCount,
                     self.stylesOffset,
                     self.flags))

        if self.stringCount > 0:
            print()
            print("String Table: ")
            for i, s in enumerate(self):
                print("{:08d} {}".format(i, repr(s)))

        if self.styleCount > 0:
            print()
            print("Styles Table: ")
            for i in range(self.styleCount):
                print("{:08d} {}".format(i, repr(self.getStyle(i))))
691934
def prettyPrintPacket(ctrl_table):
	
	print('---------------------------------------')
	print("{:.<29} {}".format('id', ctrl_table['id']))
	ctrl_table.pop('id')
	for key, value in ctrl_table.items():
		print("{:.<29} {}".format(key, value))
833142
def table(*columns, &_block)
      rows = []
      yield(rows)

      # determine maximum cell widths
      max_cell_widths = rows.reduce(Array.new(columns.length, 0)) do |result, row|
        lengths = row.map { |column| column.to_s.length }
        result.each_with_index { |length, index| result[index] = ([length, lengths[index]].max rescue length) }
      end
      columns.each_with_index { |col, index| col[:actual_width] ||= max_cell_widths[index] }

      # determine actual column width
      column_widths = columns.map do |column|
        if column[:width] == :rest
          nil
        elsif column[:width]
          column[:width]
        elsif column[:min_width]
          [column[:min_width], column[:actual_width]].max
        elsif column[:max_width]
          [column[:max_width], column[:actual_width]].min
        else
          column[:actual_width]
        end
      end

      if column_widths.include?(nil)
        width_left = options[:width] - ((columns.length - 1) * (style[:cell_separator] ? 3 : 1)) - column_widths.compact.reduce(0) { |sum, col| sum + col }
        column_widths[column_widths.index(nil)] = width_left
      end

      line(:green) if @style[:top_line]

      # Print table header
      if table_has_header?(columns)
        column_titles = []
        columns.each_with_index do |column, index|
          width = column_widths[index]
          alignment = (column[:align] == :right ? '' : '-')
          column_titles.push(colorize("%#{alignment}#{width}s" % column[:title].to_s[0...width], :bold))
        end

        puts column_titles.join(style[:cell_separator] ? " #{characters[:vertical_line]} " : ' ')
        line(:green)
      end

      # Print the rows
      rows.each do |row|
        row_values = []
        columns.each_with_index do |column, index|
          width = column_widths[index]
          case column[:type]
          when :ratio
            if width > 4
              if column[:treshold] && column[:treshold] < row[index].to_f
                bar = ''
                bar << characters[:block] * (width.to_f * column[:treshold]).round
                bar << colorize(characters[:block] * (width.to_f * (row[index].to_f - column[:treshold])).round, :red)
                row_values.push(bar)
              else
                # Create a bar by combining block characters
                row_values.push(characters[:block] * (width.to_f * row[index].to_f).round)
              end
            else
              # Too few characters for a ratio bar. Display nothing
              row_values.push('')
            end
          else
            alignment = (columns[index][:align] == :right ? '' : '-')
            cell_value = "%#{alignment}#{width}s" % row[index].to_s[0...width]
            cell_value = colorize(cell_value, :bold, :brown) if columns[index][:highlight]
            row_values.push(cell_value)
          end
        end
        puts row_values.join(style[:cell_separator] ? " #{characters[:vertical_line]} " : ' ')
      end
    end
413083
def print_table(rows, override_headers=None, uppercase_headers=True):
    """"""
    if len(rows) == 0:
        return
    keys = list(rows[0].keys())
    headers = override_headers or keys
    if uppercase_headers:
        rows = [dict(zip(keys,
                         map(lambda x: x.upper(), headers))), None] + rows
    else:
        rows = [dict(zip(keys, headers)), None] + rows

    lengths = [max(len(str(row[k]))
                   for row in rows if hasattr(row, '__iter__')) for k in keys]
    tmp = ['{%s:%i}' % (h, l) for h, l in zip(keys[: -1], lengths[: -1])]
    tmp.append('{%s}' % keys[-1])
    template = (' ' * 4).join(tmp)

    for row in rows:
        if type(row) == str:
            print(row)
        elif row is None:
            print()
        elif isinstance(row, dict): 
            row = {k: v if v is not None else 'None' for k, v in row.items()}
            print(template.format(**row))
        else:
            print("Unhandled row type:", row)
1314169
def info(self):
        
        for key, value in self.dataset['info'].items():
            print('{}: {}'.format(key, value))
154717
function print_headers() {
        global $CFG, $OUTPUT, $PAGE;

        echo html_writer::start_tag('thead');
        echo html_writer::start_tag('tr');
        foreach ($this->columns as $column => $index) {

            $icon_hide = '';
            if ($this->is_collapsible) {
                $icon_hide = $this->show_hide_link($column, $index);
            }

            $primarysortcolumn = '';
            $primarysortorder  = '';
            if (reset($this->prefs['sortby'])) {
                $primarysortcolumn = key($this->prefs['sortby']);
                $primarysortorder  = current($this->prefs['sortby']);
            }

            switch ($column) {

                case 'fullname':
                    // Check the full name display for sortable fields.
                    if (has_capability('moodle/site:viewfullnames', $PAGE->context)) {
                        $nameformat = $CFG->alternativefullnameformat;
                    } else {
                        $nameformat = $CFG->fullnamedisplay;
                    }

                    if ($nameformat == 'language') {
                        $nameformat = get_string('fullnamedisplay');
                    }

                    $requirednames = order_in_string(get_all_user_name_fields(), $nameformat);

                    if (!empty($requirednames)) {
                        if ($this->is_sortable($column)) {
                            // Done this way for the possibility of more than two sortable full name display fields.
                            $this->headers[$index] = '';
                            foreach ($requirednames as $name) {
                                $sortname = $this->sort_link(get_string($name),
                                        $name, $primarysortcolumn === $name, $primarysortorder);
                                $this->headers[$index] .= $sortname . ' / ';
                            }
                            $helpicon = '';
                            if (isset($this->helpforheaders[$index])) {
                                $helpicon = $OUTPUT->render($this->helpforheaders[$index]);
                            }
                            $this->headers[$index] = substr($this->headers[$index], 0, -3). $helpicon;
                        }
                    }
                break;

                case 'userpic':
                    // do nothing, do not display sortable links
                break;

                default:
                    if ($this->is_sortable($column)) {
                        $helpicon = '';
                        if (isset($this->helpforheaders[$index])) {
                            $helpicon = $OUTPUT->render($this->helpforheaders[$index]);
                        }
                        $this->headers[$index] = $this->sort_link($this->headers[$index],
                                $column, $primarysortcolumn == $column, $primarysortorder) . $helpicon;
                    }
            }

            $attributes = array(
                'class' => 'header c' . $index . $this->column_class[$column],
                'scope' => 'col',
            );
            if ($this->headers[$index] === NULL) {
                $content = '&nbsp;';
            } else if (!empty($this->prefs['collapse'][$column])) {
                $content = $icon_hide;
            } else {
                if (is_array($this->column_style[$column])) {
                    $attributes['style'] = $this->make_styles_string($this->column_style[$column]);
                }
                $helpicon = '';
                if (isset($this->helpforheaders[$index]) && !$this->is_sortable($column)) {
                    $helpicon  = $OUTPUT->render($this->helpforheaders[$index]);
                }
                $content = $this->headers[$index] . $helpicon . html_writer::tag('div',
                        $icon_hide, array('class' => 'commands'));
            }
            echo html_writer::tag('th', $content, $attributes);
        }

        echo html_writer::end_tag('tr');
        echo html_writer::end_tag('thead');
    }
94458
def describe_contents(self):
        
        print('======================================================================')
        print(self)
        print('Table  = ',  str(len(self.header)) + ' cols x ' + str(len(self.arr)) + ' rows')
        print('HEADER = ', self.get_header())
        print('arr    = ', self.arr[0:2])
245171
private void printWorkerInfo(List<WorkerInfo> workerInfoList) {
    mIndentationLevel = 0;
    if (mCapacityTierInfoMap.size() == 0) {
      return;
    } else if (mCapacityTierInfoMap.size() == 1) {
      // Do not print Total value when only one tier exists
      printShortWorkerInfo(workerInfoList);
      return;
    }
    Set<String> tiers = mCapacityTierInfoMap.keySet();
    String tiersInfo = String.format(Strings.repeat("%-14s", tiers.size()), tiers.toArray());
    String longInfoFormat = getInfoFormat(workerInfoList, false);
    print(String.format("%n" + longInfoFormat,
        "Worker Name", "Last Heartbeat", "Storage", "Total", tiersInfo));

    for (WorkerInfo info : workerInfoList) {
      String workerName = info.getAddress().getHost();

      long usedBytes = info.getUsedBytes();
      long capacityBytes = info.getCapacityBytes();

      String usedPercentageInfo = "";
      if (capacityBytes != 0) {
        int usedPercentage = (int) (100L * usedBytes / capacityBytes);
        usedPercentageInfo = String.format(" (%s%%)", usedPercentage);
      }

      String capacityTierInfo = getWorkerFormattedTierValues(mCapacityTierInfoMap, workerName);
      String usedTierInfo = getWorkerFormattedTierValues(mUsedTierInfoMap, workerName);

      print(String.format(longInfoFormat, workerName, info.getLastContactSec(), "capacity",
          FormatUtils.getSizeFromBytes(capacityBytes), capacityTierInfo));
      print(String.format(longInfoFormat, "", "", "used",
          FormatUtils.getSizeFromBytes(usedBytes) + usedPercentageInfo, usedTierInfo));
    }
  }
135016
def print_known_info
      rows = []
      rows += method_values_for_plugin_hashes(core_dsl_attributes)
      rows << ["---", "---"]
      rows += method_values_for_plugin_hashes(external_dsl_attributes)
      rows << ["---", "---"]
      rows << ["SCM", env.scm.class]
      rows << ["Source", env.ci_source.class]
      rows << ["Requests", env.request_source.class]
      rows << ["Base Commit", env.meta_info_for_base]
      rows << ["Head Commit", env.meta_info_for_head]

      params = {}
      params[:rows] = rows.each { |current| current[0] = current[0].yellow }
      params[:title] = "Danger v#{Danger::VERSION}\nDSL Attributes".green

      ui.section("Info:") do
        ui.puts
        table = Terminal::Table.new(params)
        table.align_column(0, :right)
        ui.puts table
        ui.puts
      end
    end
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")
748335
def print_events(events):
    """"""
    columns = ['Date', 'Type', 'IP Address', 'label', 'username']
    table = formatting.Table(columns)
    for event in events:
        table.add_row([event.get('eventCreateDate'), event.get('eventName'),
                       event.get('ipAddress'), event.get('label'), event.get('username')])
    return table
459708
def _generate_html_table(data, out, level=0, extra_style=''):
    '''
    
    '''
    print('<table style="{0}">'.format(
        _lookup_style('table', ['table' + six.text_type(level)])), file=out)

    firstone = True

    row_style = 'row' + six.text_type(level)
    cell_style = 'cell' + six.text_type(level)

    for subdata in data:
        first_style = 'first_first' if firstone else 'notfirst_first'
        second_style = 'first' if firstone else 'other'

        if isinstance(subdata, dict):
            if '__style__' in subdata:
                new_extra_style = subdata['__style__']
                del subdata['__style__']
            else:
                new_extra_style = extra_style
            if len(subdata) == 1:
                name, value = next(six.iteritems(subdata))
                print('<tr style="{0}">'.format(
                    _lookup_style('tr', [row_style])
                ), file=out)
                print('<td style="{0}">{1}</td>'.format(
                    _lookup_style(
                        'td',
                        [cell_style, first_style, 'name', new_extra_style]
                    ),
                    name
                ), file=out)
                if isinstance(value, list):
                    print('<td style="{0}">'.format(
                        _lookup_style(
                            'td',
                            [
                                cell_style,
                                second_style,
                                'container',
                                new_extra_style
                            ]
                        )
                    ), file=out)
                    _generate_html_table(
                        value,
                        out,
                        level + 1,
                        new_extra_style
                    )
                    print('</td>', file=out)
                else:
                    print('<td style="{0}">{1}</td>'.format(
                        _lookup_style(
                            'td',
                            [
                                cell_style,
                                second_style,
                                'value',
                                new_extra_style
                            ]
                        ),
                        cgi.escape(six.text_type(value))
                    ), file=out)
                print('</tr>', file=out)
        elif isinstance(subdata, list):
            print('<tr style="{0}">'.format(
                _lookup_style('tr', [row_style])
            ), file=out)
            print('<td style="{0}">'.format(
                _lookup_style(
                    'td',
                    [cell_style, first_style, 'container', extra_style]
                )
            ), file=out)
            _generate_html_table(subdata, out, level + 1, extra_style)
            print('</td>', file=out)
            print('</tr>', file=out)
        else:
            print('<tr style="{0}">'.format(
                _lookup_style('tr', [row_style])
            ), file=out)
            print('<td style="{0}">{1}</td>'.format(
                _lookup_style(
                    'td',
                    [cell_style, first_style, 'value', extra_style]
                ),
                cgi.escape(six.text_type(subdata))
            ), file=out)
            print('</tr>', file=out)
        firstone = False
    print('</table>', file=out)
1163446
def print_user(self, user):
    '''
    ''' 
    status = "active"
    token = user.token

    if token in ['finished', 'revoked']:
        status = token

    if token is None:
        token = ''
  
    subid = "%s\t%s[%s]" %(user.id, token, status)
    print(subid)
    return subid
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)) + " |")
470295
def print_sub(tables):
    
    logger = logging.getLogger("meepo.sub.print_sub")
    logger.info("print_sub tables: %s" % ", ".join(tables))

    if not isinstance(tables, (list, set)):
        raise ValueError("tables should be list or set")

    events = ("%s_%s" % (tb, action) for tb, action in
              itertools.product(*[tables, ["write", "update", "delete"]]))
    for event in events:
        signal(event).connect(
            lambda pk: logger.info("%s -> %s" % event, pk), weak=False)
853697
def print_info(self, buf=None):
        """"""
        buf = buf or sys.stdout
        print >> buf, "Sections:"
        for i, section in enumerate(self._sections):
            print >> buf, "  %s:\t%s (%s)" % (i + 1, section[0], section[1])