Get global stats about mailboxes

        Parses <stats numMboxes="6" totalSize="141077"/>

        :returns: dict with stats
766687
def get_mailbox_stats(self):
        
        resp = self.request_single('GetMailboxStats')
        ret = {}
        for k, v in resp.items():
            ret[k] = int(v)

        return ret
1084578
def getVoicemailStats(self):
        
        if not self.hasVoicemail():
            return None
        if self.checkVersion('1.4'):
            cmd = "voicemail show users"
        else:
            cmd = "show voicemail users"
        cmdresp = self.executeCommand(cmd)

        info_dict = dict(accounts = 0, avg_messages = 0, max_messages = 0, 
                         total_messages = 0)
        for line in cmdresp.splitlines():
            mobj = re.match('\w+\s+\w+\s+.*\s+(\d+)\s*$', line)
            if mobj:
                msgs = int(mobj.group(1))
                info_dict['accounts'] += 1
                info_dict['total_messages'] += msgs
                if msgs > info_dict['max_messages']:
                    info_dict['max_messages'] = msgs
        if info_dict['accounts'] > 0:
            info_dict['avg_messages'] = (float(info_dict['total_messages']) 
                                         / info_dict['accounts'])
            
        return info_dict
875181
def get_daemon_stats(self, details=False):
        
        # call the daemon one
        res = super(Satellite, self).get_daemon_stats(details=details)

        counters = res['counters']
        counters['broks'] = len(self.broks)
        counters['events'] = len(self.events)
        counters['workers'] = len(self.workers)

        if self.workers:
            res['workers'] = {}
            for worker in list(self.workers.values()):
                stats = getattr(self.workers[worker.get_id()], 'stats', None)
                if stats:
                    res['workers'][worker.get_id()] = stats

        return res
250521
def get_stats(self, queue):
        
        uri = "/%s/%s/stats" % (self.uri_base, utils.get_id(queue))
        resp, resp_body = self.api.method_get(uri)
        return resp_body.get("messages")
726692
def get_stats(package):
    

    grand_total = 0

    if '==' in package:
        package, version = package.split('==')
    try:
        package = normalize(package)
        version = None
    except ValueError:
        raise RuntimeError('No such module or package %r' % package)

    # Count downloads
    total, releases = count_downloads(
        package,
        json=True,
        version=version,
    )

    result = {
        'version': version,
        'releases': releases,
    }

    grand_total += total

    return result, grand_total, version
815376
def get_all_stats(self):
        '''
        
        '''
        self.logger.debug("Gathering all stats")
        the_dict = {}
        the_dict['kafka-monitor'] = self.get_kafka_monitor_stats()
        the_dict['redis-monitor'] = self.get_redis_monitor_stats()
        the_dict['crawler'] = self.get_crawler_stats()
        the_dict['rest'] = self.get_rest_stats()

        return the_dict
983929
def get_global_name_value(self):
        
        if self._has_global_stats:
            name, value = self.get_global()
            if not isinstance(name, list):
                name = [name]
            if not isinstance(value, list):
                value = [value]
            return list(zip(name, value))
        else:
            return self.get_name_value()
912577
def read_stats(self):
        

        self.statistics = TgnObjectsDict()
        for port in self.session.ports.values():
            for tpld in port.tplds.values():
                self.statistics[tpld] = tpld.read_stats()
        return self.statistics
321582
def stats(self):
        
        response = self.requester.get(
            '/{endpoint}/{id}/stats',
            endpoint=self.endpoint, id=self.id
        )
        return response.json()
619448
def getStats(self):
        
        stats = protocol.ReadStats()
        stats.aligned_read_count = self._numAlignedReads
        stats.unaligned_read_count = self._numUnalignedReads
        return stats
1120682
def stats_to_list(stats_dict, localize=pytz):
    
    result = stats_dict['GetSendStatisticsResponse']['GetSendStatisticsResult']
    # Make a copy, so we don't change the original stats_dict.
    result = copy.deepcopy(result)
    datapoints = []
    if localize:
        current_tz = localize.timezone(settings.TIME_ZONE)
    else:
        current_tz = None
    for dp in result['SendDataPoints']:
        if current_tz:
            utc_dt = datetime.strptime(dp['Timestamp'], '%Y-%m-%dT%H:%M:%SZ')
            utc_dt = localize.utc.localize(utc_dt)
            dp['Timestamp'] = current_tz.normalize(
                utc_dt.astimezone(current_tz))
        datapoints.append(dp)

    datapoints.sort(key=lambda x: x['Timestamp'])

    return datapoints
303445
def get_global_count(self):
        
        
        # Check current number of json files in results directory and dump current json in new file
        path_to_json = self.results_folder_name + '/'
        json_files = [pos_json for pos_json in os.listdir(path_to_json) if pos_json.endswith('.json')]
        Wrapper.global_count = len(json_files) + 1
        return Wrapper.global_count
921680
def get_stats(self):
        
        stats = {}
        for name, cls in self.stats.items():
            path = self.paths[name]
            if os.path.exists(path):
                try:
                    stats[name] = self._PARSERS[cls](fileops.read(path))
                except IOError as e:
                    # XXX: we have to distinguish unexpected errors from the expected ones
                    if e.errno == errno.EOPNOTSUPP:
                        # Since 3.5 memory.memsw.* are always created even if disabled.
                        # If disabled we will get EOPNOTSUPP when read or write them.
                        # See commit af36f906c0f4c2ffa0482ecdf856a33dc88ae8c5 of the kernel.
                        pass
                    if e.errno == errno.EIO:
                        # memory.kmem.slabinfo throws EIO until limit_in_bytes is set.
                        pass
                    else:
                        raise
        return stats
173025
def get_flat_stats(self):
        
        flat_stats = OrderedDict()
        for obj, port_stats in self.statistics.items():
            flat_obj_stats = OrderedDict()
            for group_name, group_values in port_stats.items():
                for stat_name, stat_value in group_values.items():
                    full_stat_name = group_name + '_' + stat_name
                    flat_obj_stats[full_stat_name] = stat_value
            flat_stats[obj.name] = flat_obj_stats
        return flat_stats
1069970
def get_stats_dict(a_in, full=True):
    
    d = {}
    a = checkma(a_in)
    d['count'] = a.count()
    thresh = 4E6
    if not full and d['count'] > thresh:
        a = a.compressed()
        stride = int(np.around(a.size / thresh))
        #a = np.ma.array(a[::stride])
        a = a[::stride]
    d['min'] = a.min()
    d['max'] = a.max()
    d['ptp'] = d['max'] - d['min']
    d['mean'] = a.mean(dtype='float64')
    d['std'] = a.std(dtype='float64')
    d['nmad'], d['med'] = mad(a, return_med=True)
    d['median'] = d['med']
    d['p16'], d['p84'], d['spread'] = robust_spread(a)
    from scipy.stats.mstats import mode 
    d['mode'] = mode(a, axis=None)[0]
    for i in d:
        d[i] = float(d[i])
    d['count'] = int(d['count'])
    return d
223461
def get_daemon_stats(self, details=False):
        
        # Call the base Daemon one
        res = super(Alignak, self).get_daemon_stats(details=details)

        res.update({'name': self.name, 'type': self.type, 'monitored_objects': {}})

        counters = res['counters']

        # Satellites counters
        counters['brokers'] = len(self.brokers)
        counters['pollers'] = len(self.pollers)
        counters['reactionners'] = len(self.reactionners)
        counters['receivers'] = len(self.receivers)

        if not self.sched:
            return res

        # # Hosts/services problems counters
        # m_solver = MacroResolver()
        # counters['hosts_problems'] = m_solver._get_total_host_problems()
        # counters['hosts_unhandled_problems'] = m_solver._get_total_host_problems_unhandled()
        # counters['services_problems'] = m_solver._get_total_service_problems()
        # counters['services_unhandled_problems'] = m_solver._get_total_service_problems_unhandled()

        # Get statistics from the scheduler
        scheduler_stats = self.sched.get_scheduler_stats(details=details)
        res['counters'].update(scheduler_stats['counters'])
        scheduler_stats.pop('counters')
        res.update(scheduler_stats)

        return res
306315
def _GetStat(self):
    
    stat_object = super(GzipFileEntry, self)._GetStat()

    if self._gzip_file:
      stat_object.size = self._gzip_file.uncompressed_data_size

    # Other stat information.
    # gzip_file.comment
    # gzip_file.operating_system
    # gzip_file.original_filename

    return stat_object