Return a formatted one-line string with the statistics
        values for the operation for which this statistics object
        maintains data.

        This is a low-level method that is called by
        :meth:`pywbem.Statistics.formatted`.
485615
def formatted(self, include_server_time):
        
        if include_server_time:  # pylint: disable=no-else-return
            return ('{0:5d} {1:5d} '
                    '{2:7.3f} {3:7.3f} {4:7.3f} '
                    '{5:7.3f} {6:7.3f} {7:7.3f} '
                    '{8:6.0f} {9:6.0f} {10:6.0f} '
                    '{11:8.0f} {12:8.0f} {13:8.0f} {14}\n'.
                    format(self.count, self.exception_count,
                           self.avg_time, self.min_time, self.max_time,
                           self.avg_server_time, self.min_server_time,
                           self.max_server_time,
                           self.avg_request_len, self.min_request_len,
                           self.max_request_len,
                           self.avg_reply_len, self.min_reply_len,
                           self.max_reply_len,
                           self.name))
        else:
            return ('{0:5d} {1:5d} '
                    '{2:7.3f} {3:7.3f} {4:7.3f} '
                    '{5:6.0f} {6:6.0f} {7:6.0f} '
                    '{8:6.0f} {9:8.0f} {10:8.0f} {11}\n'.
                    format(self.count, self.exception_count,
                           self.avg_time, self.min_time, self.max_time,
                           self.avg_request_len, self.min_request_len,
                           self.max_request_len,
                           self.avg_reply_len, self.min_reply_len,
                           self.max_reply_len,
                           self.name))
402413
def pretty_str(self, indent=0):
        
        indent = ' ' * indent
        if self.value is not None:
            return '{}{} {}'.format(indent, self.name, pretty_str(self.value))
        return indent + self.name
1038222
def pretty_str(self, indent=0):
        
        if self.parenthesis:
            return '{}({})'.format(' ' * indent, pretty_str(self.value))
        return pretty_str(self.value, indent=indent)
97983
def format_data(data):
    
    if data is None:
        return None
    return u":".join([u"{:02x}".format(ord(c)) for c in data])
933548
def pretty_str(self, indent=0):
        
        indent = ' ' * indent
        pretty = '{}({})' if self.parenthesis else '{}{}'
        args = ', '.join(map(pretty_str, self.arguments))
        if self.method_of:
            call = '{}.{}({})'.format(self.method_of.pretty_str(),
                                      self.name, args)
        elif self.is_constructor:
            call = 'new {}({})'.format(self.name, args)
        else:
            call = '{}({})'.format(self.name, args)
        return pretty.format(indent, call)
388613
def formatted_command(self):
        
        # FIXME, this isn't really great as it force you to have all the arguments
        command_template = self.command_template()
        format_dict = self.args.copy()

        for key, value in format_dict.items():
            # protect whitespace
            if isinstance(value, list):
                outstr = ""
                if key == 'args':
                    outkey = ""
                else:
                    outkey = "--%s "
                for lval in value:
                    outstr += ' '
                    outstr += outkey
                    outstr += lval
                format_dict[key] = '"%s"' % outstr
            elif isinstance(value, str) and value.find(' ') >= 0 and key != 'args':
                format_dict[key] = '"%s"' % value
            elif value is None:
                format_dict[key] = 'none'

        command = command_template.format(**format_dict)
        return command
854155
def _dataToString(self, data):
        
        if self.specialValueText is not None and data == self.minValue:
            return self.specialValueText
        else:
            return "{}{:.{}f}{}".format(self.prefix, data, self.decimals, self.suffix)
1065549
def format_sync_stats(self, cnt):
        '''
        
        '''
        stats = salt.utils.odict.OrderedDict()
        if cnt.get('retcode') == salt.defaults.exitcodes.EX_OK:
            for line in cnt.get('stdout', '').split(os.linesep):
                line = line.split(': ')
                if len(line) == 2:
                    stats[line[0].lower().replace(' ', '_')] = line[1]
            cnt['transfer'] = stats
            del cnt['stdout']

        # Remove empty
        empty_sections = []
        for section in cnt:
            if not cnt[section] and section != 'retcode':
                empty_sections.append(section)
        for section in empty_sections:
            del cnt[section]

        return cnt
788174
def formatted_str(self, format):
        
        assert(format in ('json', 'csv'))
        ret_str_list = []
        for rec in self._records:
            if format == 'json':
                ret_str_list.append('{')
                for i in xrange(len(rec)):
                    colname, colval = self._rdef[i].name, rec[i]
                    ret_str_list.append('"%s":"%s"' % (colname, str(colval).replace('"', r'\"')))
                    ret_str_list.append(',')
                ret_str_list.pop()  # drop last comma
                ret_str_list.append('}%s' % (os.linesep))
            elif format == 'csv':
                for i in xrange(len(rec)):
                    colval = rec[i]
                    ret_str_list.append('"%s"' % (str(colval).replace('"', r'\"')))
                    ret_str_list.append(',')
                ret_str_list.pop()  # drop last comma
                ret_str_list.append('%s' % (os.linesep))
            else:
                assert(False)
        return ''.join(ret_str_list)
1131526
def string_format(data, out, opts=None, **kwargs):
    '''
    
    '''
    raw_output = try_printout(data, out, opts, **kwargs)
    ansi_escape = re.compile(r'\x1b[^m]*m')
    return ansi_escape.sub('', raw_output)
763216
private String getStatsString() {
    SplitTypeStats allTypeStats = splitTypeStatsMap.get(SplitType.ALL);
    Map<String, Map<String, Number>> statsMapMap =
      new HashMap<String, Map<String, Number>>();
    for (Map.Entry<SplitType, SplitTypeStats> entry :
        splitTypeStatsMap.entrySet()) {
      Map<String, Number> statsMap = new HashMap<String, Number>();
      statsMapMap.put(entry.getKey().toString(), statsMap);

      float percentTotalSplitCount =
        (100f * entry.getValue().getTotalSplitCount()) /
        allTypeStats.getTotalSplitCount();
      float percentTotalSize =
        (100f * entry.getValue().getTotalSize()) /
        allTypeStats.getTotalSize();
      float percentTotalBlockCount =
          (100f * entry.getValue().getTotalBlockCount()) /
          allTypeStats.getTotalBlockCount();
      float averageSizePerSplit =
          ((float) entry.getValue().getTotalSize()) /
          entry.getValue().getTotalSplitCount();
      float averageHostCountPerSplit =
         ((float) entry.getValue().getTotalHostCount()) /
         entry.getValue().getTotalSplitCount();
      float averageBlockCountPerSplit =
          ((float) entry.getValue().getTotalBlockCount()) /
          entry.getValue().getTotalSplitCount();
      statsMap.put("totalSplitCount", entry.getValue().getTotalSplitCount());
      statsMap.put("percentTotalSplitCount", percentTotalSplitCount);
      statsMap.put("totalSize", entry.getValue().getTotalSize());
      statsMap.put("percentTotalSize", percentTotalSize);
      statsMap.put("averageSizePerSplit", averageSizePerSplit);
      statsMap.put("totalHostCount", entry.getValue().getTotalHostCount());
      statsMap.put("averageHostCountPerSplit", averageHostCountPerSplit);
      statsMap.put("totalBlockCount", entry.getValue().getTotalBlockCount());
      statsMap.put("percentTotalBlockCount", percentTotalBlockCount);
      statsMap.put("averageBlockCountPerSplit", averageBlockCountPerSplit);
    }
    return JSON.toString(statsMapMap);
  }
1047579
def stats(self, query=None, target=None):
        
        with self.lock:
            if not query:
                self.send('STATS')
            elif not target and query:
                self.send('STATS %s' % query)
            else:
                self.send('STATS %s %s' % (query, target))
            stat_lines = []
            while self.readable():
                msg = self._recv()
                if msg[1] == '219':
                    break
                else:
                    stat_lines.append(msg[3].replace(':', '', 1))
            return stat_lines
1285616
def format_string(current_size, total_length, elapsed_time):
    

    n_to_mb = current_size / _KILOBYTE / _KILOBYTE
    elapsed_str = seconds_to_time(elapsed_time)

    rate = _RATE_FORMAT % (n_to_mb / elapsed_time) if elapsed_time else _UNKNOWN_SIZE
    frac = float(current_size) / total_length
    bar_length = int(frac * _BAR_SIZE)
    bar = _FINISHED_BAR * bar_length + _REMAINING_BAR * (_BAR_SIZE - bar_length)
    percentage = _PERCENTAGE_FORMAT % (frac * 100)
    left_str = seconds_to_time(
        elapsed_time / current_size * (total_length - current_size)) if current_size else _UNKNOWN_SIZE

    humanized_total = _HUMANINZED_FORMAT % (total_length / _KILOBYTE / _KILOBYTE) + _STR_MEGABYTE
    humanized_n = _HUMANINZED_FORMAT % n_to_mb + _STR_MEGABYTE

    return _DISPLAY_FORMAT % (
        bar, humanized_n, humanized_total, percentage, elapsed_str, left_str, rate)
106751
def stats():
    '''
    
    '''
    ret = {}
    cmd = 'locate -S'
    out = __salt__['cmd.run'](cmd).splitlines()
    for line in out:
        comps = line.strip().split()
        if line.startswith('Database'):
            ret['database'] = comps[1].replace(':', '')
            continue
        ret[' '.join(comps[1:])] = comps[0]
    return ret
745518
def format(self):
        '''
        '''
        c = n = ''
        if not self.both:
            c = ' (code only)'
        if self.leng:
            n = ' (%s)' % _nameof(self.leng)
        return _kwds(base=self.base, item=self.item, leng=n,
                     code=c,         kind=self.kind)
757534
def one_liner_str(self):
        """"""
        assert self.less_attrs is not None, "Forgot to set attrs class variable"
        s_format = "{}={}"
        s = "; ".join([s_format.format(x, self.__getattribute__(x)) for x in self.less_attrs])
        return s
1124094
def output(data, **kwargs):  # pylint: disable=unused-argument
    '''
    
    '''
    if isinstance(data, Exception):
        data = six.text_type(data)
    if 'output_indent' in __opts__ and __opts__['output_indent'] >= 0:
        return pprint.pformat(data, indent=__opts__['output_indent'])
    return pprint.pformat(data)