Displays statistics about our LM
358575
def display(self):
        '''
        
        '''
        voc_list = []
        doc_ids = self.term_count_n.keys()
        doc_ids.sort()
        for doc_id in doc_ids:
            ngrams = len(self.term_count_n[doc_id]['ngrams'])
            print 'n-Grams (doc %s): %d' % (str(doc_id), ngrams)
            ngrams1 = len(self.term_count_n_1[doc_id]['ngrams'])
            print '(n-1)-Grams (doc %s): %d' % (str(doc_id), ngrams1)
            voc_list.append(ngrams)
        print 'Classed Vocabularies:', voc_list
        print ''
        corpus_ngrams = len(self.corpus_count_n['ngrams']) 
        print 'n-Grams (collection): %d' % (corpus_ngrams)
        corpus_ngrams1 = len(self.corpus_count_n_1['ngrams']) 
        print '(n-1)-Grams (collection): %d' % (corpus_ngrams1)
        self.unseen_counts.display()
760959
def print_event_statistics(self):
        """"""
        logger.info('All events by type')
        logger.info('-------------------')
        for k, v in self.all_events.items():
            logger.info('%s, %s' % (k, len(v)))
        logger.info('-------------------')
612521
def info():
    """"""
    print("convenience function for listing prms")
    print(type(prms))
    print(prms.__name__)
    print(f"prm file: {_get_prm_file()}")

    for key in prms.__dict__:
        if isinstance(prms.__dict__[key], box.Box):
            print()
            print(80 * "=")
            print(f"prms.{key}:")
            print(80 * "-")
            for subkey in prms.__dict__[key]:
                print(
                    f"prms.{key}.{subkey} = ",
                    f"{prms.__dict__[key][subkey]}"
                )
            print(80 * "=")
785686
def league_scores(self, total_data, time, show_upcoming, use_12_hour_format):
        """"""
        headers = ['League', 'Home Team Name', 'Home Team Goals',
                   'Away Team Goals', 'Away Team Name']
        result = [headers]
        league = total_data['competition']['name']
        result.extend([league,
                       score['homeTeam']['name'],
                       score['score']['fullTime']['homeTeam'],
                       score['score']['fullTime']['awayTeam'],
                        score['awayTeam']['name']]
                       for score in total_data['matches'])
        self.generate_output(result)
306333
def show_busy(self):
        """"""
        self.progress_bar.show()
        self.question_group.setEnabled(False)
        self.question_group.setVisible(False)
        enable_busy_cursor()
        self.repaint()
        qApp.processEvents()
        self.busy = True
1251300
def statistics(self):
        
        if self._statistics is None:
            self._statistics = WorkerStatisticsList(
                self._version,
                workspace_sid=self._solution['workspace_sid'],
                worker_sid=self._solution['sid'],
            )
        return self._statistics
91284
public function searchwordStatisticsAction()
    {
        // days to show
        $days = 30;
        $data = $this->getSearchwordStatistics($this->id, $days);

        if ($data['error']) {
            $error = $data['error'];
            unset($data['error']);
        }

        $this->view->assign('days', $days);
        $this->view->assign('data', $data);
        $this->view->assign('error', $error);
        $this->view->assign('languages', $this->getLanguages());
    }
679053
def show(self):
        
        if not self._error and not self.stats:
            return
        self.header()
        for stat in self.stats:
            utils.item(stat, level=1, options=self.options)
1270207
def print_stats(self, header=True, file=sys.stdout):
        """"""
        if header:
            print("CACHE {:*^18} {:*^18} {:*^18} {:*^18} {:*^18}".format(
                "HIT", "MISS", "LOAD", "STORE", "EVICT"), file=file)
        for s in self.stats():
            print("{name:>5} {HIT_count:>6} ({HIT_byte:>8}B) {MISS_count:>6} ({MISS_byte:>8}B) "
                  "{LOAD_count:>6} ({LOAD_byte:>8}B) {STORE_count:>6} "
                  "({STORE_byte:>8}B) {EVICT_count:>6} ({EVICT_byte:>8}B)".format(
                    HIT_bytes=2342, **s),
                  file=file)
1184483
def display(self):
        """"""
        size = list(range(len(self.layers)))
        size.reverse()
        for i in size:
            layer = self.layers[i]
            if layer.active:
                print('%s layer (size %d)' % (layer.name, layer.size))
                tlabel, olabel = '', ''
                if (layer.type == 'Output'):
                    if self.countWrong:
                        tlabel = ' (%s)' % self.classify(layer.target.tolist())
                        olabel = ' (%s)' % self.classify(layer.activation.tolist())
                        if olabel == tlabel:
                            self.numRight += 1
                        else:
                            olabel += '  *** WRONG ***'
                            self.numWrong += 1
                            if self.actDisplay is not None:
                                self.actDisplay.showWrong()
                    print('Target    : %s%s' % (pretty(layer.target, max=15), tlabel))
                print('Activation: %s%s' % (pretty(layer.activation, max=15), olabel))
                if self.patterned and layer.type != 'Hidden':
                    targetWord, diff = self.getWord( layer.target, returnDiff = 1)
                    if layer.kind == 'Output':
                        if targetWord == None:
                            print("Target Pattern   = %s" % "No match")
                        else:
                            if diff == 0.0:
                                print("Target Pattern   = '%s'" % targetWord)
                            else:
                                print("Target Pattern   = '%s'; difference = %f)" % (targetWord, diff))
                    actWord, diff = self.getWord( layer.activation, returnDiff = 1 )
                    if (layer.kind == 'Input' or layer.kind == 'Output'):
                        if actWord == None:
                            print("Matching Pattern = %s" % "No match")
                        else:
                            if diff == 0.0:
                                print("Matching Pattern = '%s'" % actWord)
                            else:
                                print("Matching Pattern = '%s'; difference = %f" % (actWord, diff))
                print("------------------------------------")
1194401
def manage_itstat(self):
        """"""

        # Extract and record iteration stats
        itst = self.iteration_stats()
        self.itstat.append(itst)
        self.display_status(self.fmtstr, itst)
1202276
private void printStatus() {
		System.out.println("---");
		printStatistics(this.itemStatistics, "items");
		System.out.println(" * Site links: " + this.countSiteLinks);

		printStatistics(this.propertyStatistics, "properties");
	}
617898
def show_info(ulog, verbose):
    """"""
    m1, s1 = divmod(int(ulog.start_timestamp/1e6), 60)
    h1, m1 = divmod(m1, 60)
    m2, s2 = divmod(int((ulog.last_timestamp - ulog.start_timestamp)/1e6), 60)
    h2, m2 = divmod(m2, 60)
    print("Logging start time: {:d}:{:02d}:{:02d}, duration: {:d}:{:02d}:{:02d}".format(
        h1, m1, s1, h2, m2, s2))

    dropout_durations = [dropout.duration for dropout in ulog.dropouts]
    if len(dropout_durations) == 0:
        print("No Dropouts")
    else:
        print("Dropouts: count: {:}, total duration: {:.1f} s, max: {:} ms, mean: {:} ms"
              .format(len(dropout_durations), sum(dropout_durations)/1000.,
                      max(dropout_durations),
                      int(sum(dropout_durations)/len(dropout_durations))))

    version = ulog.get_version_info_str()
    if not version is None:
        print('SW Version: {}'.format(version))

    print("Info Messages:")
    for k in sorted(ulog.msg_info_dict):
        if not k.startswith('perf_') or verbose:
            print(" {0}: {1}".format(k, ulog.msg_info_dict[k]))


    if len(ulog.msg_info_multiple_dict) > 0:
        if verbose:
            print("Info Multiple Messages:")
            for k in sorted(ulog.msg_info_multiple_dict):
                print(" {0}: {1}".format(k, ulog.msg_info_multiple_dict[k]))
        else:
            print("Info Multiple Messages: {}".format(
                ", ".join(["[{}: {}]".format(k, len(ulog.msg_info_multiple_dict[k])) for k in
                           sorted(ulog.msg_info_multiple_dict)])))



    print("")
    print("{:<41} {:7}, {:10}".format("Name (multi id, message size in bytes)",
                                      "number of data points", "total bytes"))

    data_list_sorted = sorted(ulog.data_list, key=lambda d: d.name + str(d.multi_id))
    for d in data_list_sorted:
        message_size = sum([ULog.get_field_size(f.type_str) for f in d.field_data])
        num_data_points = len(d.data['timestamp'])
        name_id = "{:} ({:}, {:})".format(d.name, d.multi_id, message_size)
        print(" {:<40} {:7d} {:10d}".format(name_id, num_data_points,
                                            message_size * num_data_points))
1294349
def output_text(account, all_data, show_hourly=False):
    """"""
    print("""
#################################
# Hydro Quebec data for account #
# {}
#################################""".format(account))
    for contract, data in all_data.items():
        data['contract'] = contract
        if data['period_total_bill'] is None:
            data['period_total_bill'] = 0.0
        if data['period_projection'] is None:
            data['period_projection'] = 0.0
        if data['period_mean_daily_bill'] is None:
            data['period_mean_daily_bill'] = 0.0
        output = ("""
----------------------------------------------------------------

Contract: {d[contract]}
===================

Balance: {d[balance]:.2f} $

Period Info
===========
Period day number:      {d[period_length]:d}
Period total days:      {d[period_total_days]:d} days

Period current bill
===================
Total Bill:             {d[period_total_bill]:.2f} $
Projection bill:        {d[period_projection]:.2f} $
Mean Daily Bill:        {d[period_mean_daily_bill]:.2f} $

Total period consumption
========================
Lower price:            {d[period_lower_price_consumption]:.2f} kWh
Higher price:           {d[period_higher_price_consumption]:.2f} kWh
Total:                  {d[period_total_consumption]:.2f} kWh
Mean daily:             {d[period_mean_daily_consumption]:.2f} kWh""")
        print(output.format(d=data))
        if data.get("period_average_temperature") is not None:
            output2 = ("""Temperature:            {d[period_average_temperature]:d} °C""")
            print(output2.format(d=data))
        if data.get("yesterday_average_temperature") is not None:
            output3 = ("""
Yesterday consumption
=====================
Temperature:            {d[yesterday_average_temperature]:d} °C
Lower price:            {d[yesterday_lower_price_consumption]:.2f} kWh
Higher price:           {d[yesterday_higher_price_consumption]:.2f} kWh
Total:                  {d[yesterday_total_consumption]:.2f} kWh""")
            print(output3.format(d=data))
        if show_hourly:
            msg = ("""
Yesterday consumption details
-----------------------------
   Hour  | Temperature | Lower price consumption | Higher price consumption | total comsumption
""")
            for hdata in data['yesterday_hourly_consumption']:
                msg += ("{d[hour]} | {d[temp]:8d} °C | {d[lower]:19.2f} kWh | "
                        "{d[high]:20.2f} kWh | {d[total]:.2f} kWh\n").format(d=hdata)
            print(msg)

        if data['annual_total_bill']:
            output3 = ("""
    Annual Total
    ============

    Start date:             {d[annual_date_start]}
    End date:               {d[annual_date_end]}
    Total bill:             {d[annual_total_bill]} $
    Mean daily bill:        {d[annual_mean_daily_bill]} $
    Total consumption:      {d[annual_total_consumption]} kWh
    Mean dailyconsumption:  {d[annual_mean_daily_consumption]} kWh
    kWh price:              {d[annual_kwh_price_cent]} ¢
    """)
            print(output3.format(d=data))
696833
def stats(self):
        
        res = {}
        db = self._collection.database
        res['dbstats'] = db.command('dbstats')
        res['data'] = db.command('collstats', self._collection.name)
        res['totals'] = {'count': res['data']['count'],
                         'size': res['data']['size']
                         }
        return res
988861
def show(self):
        """"""

        if len(self.text) > self.textwidth:
            label = self.text[0:self.textwidth]
        else:
            label = self.text.rjust(self.textwidth)

        terminalSize = getTerminalSize()
        if terminalSize is None:
            terminalSize = 80
        else:
            terminalSize = terminalSize[1]

        barWidth = terminalSize - self.textwidth - 10

        if self.value is None or self.value < 0:
            pattern = self.twiddle_sequence[
                self.twiddle % len(self.twiddle_sequence)]
            self.twiddle += 1
            barSymbols = (pattern * int(math.ceil(barWidth/3.0)))[0:barWidth]
            progressFractionText = '   . %'
        else:
            progressFraction = float(self.value) / self.max

            nBlocksFrac, nBlocksInt = math.modf(
                max(0.0, min(1.0, progressFraction)) * barWidth)
            nBlocksInt = int(nBlocksInt)

            partialBlock = self.sequence[
                int(math.floor(nBlocksFrac * len(self.sequence)))]

            nBlanks = barWidth - nBlocksInt - 1
            barSymbols = (self.sequence[-1] * nBlocksInt) + partialBlock + \
                (self.sequence[0] * nBlanks)
            barSymbols = barSymbols[:barWidth]
            progressFractionText = ('%.1f%%' % (100*progressFraction)).rjust(6)

        print >>self.fid, '\r\x1B[1m' + label + '\x1B[0m [' + barSymbols + \
            ']' + progressFractionText,
        self.fid.flush()
        self.linefed = False
311575
def log_stats(self):
    """"""
    logging.info('Validation statistics: ')
    for k, v in iteritems(self.stats):
      logging.info('%s - %d valid out of %d total submissions',
                   k, v[0], v[0] + v[1])