Return all the stats views (dict).
966493
def getAllViewsAsDict(self):
        """"""
        return {p: self._plugins[p].get_views() for p in self._plugins}
207269
def get_all_stats(self):
        

        all_stats = OrderedDict()
        for obj_name in self.statistics:
            all_stats[obj_name] = dict(zip(self.captions, self.statistics[obj_name]))
        return all_stats
444557
def get_stats(self, obj, stat_name):
        
        return [int(v) for v in self.get_attribute(obj, stat_name).split()]
1368520
def load_views(self):
        """"""
        view_path = os.path.join(self.path, StatikProject.VIEWS_DIR)
        logger.debug("Loading views from: %s", view_path)
        if not os.path.isdir(view_path):
            raise MissingProjectFolderError(StatikProject.VIEWS_DIR)

        view_files = list_files(view_path, ['yml', 'yaml'])
        logger.debug("Found %d view(s) in project", len(view_files))
        views = {}
        for view_file in view_files:
            view_name = extract_filename(view_file)
            views[view_name] = StatikView(
                filename=os.path.join(view_path, view_file),
                encoding=self.config.encoding,
                name=view_name,
                models=self.models,
                template_engine=self.template_engine,
                error_context=self.error_context
            )

        return views
1273035
def update_views(self):
        """"""
        # Call the father's method
        super(Plugin, self).update_views()

        # Add specifics informations
        try:
            # Alert and log
            self.views['min15']['decoration'] = self.get_alert_log(self.stats['min15'], maximum=100 * self.stats['cpucore'])
            # Alert only
            self.views['min5']['decoration'] = self.get_alert(self.stats['min5'], maximum=100 * self.stats['cpucore'])
        except KeyError:
            # try/except mandatory for Windows compatibility (no load stats)
            pass
456739
def snapshot_statistics(self):
        
        with self._lock:

            stats = {
                'request_count': self.request_count,
                'borrow_count': self.borrow_count,
                'sampled_count': self.sampled_count,
            }

            self._reset_statistics()
            return stats
401458
def get_stats(self):
        
        try:
            query = {
                # We only care about the aggregations, so don't return the hits
                'size': 0,
                'aggs': {
                    'num_packages': {
                        'value_count': {
                            'field': 'id',
                        },
                    },
                    'num_records': {
                        'sum': {
                            'field': 'package.count_of_rows',
                        },
                    },
                    'num_countries': {
                        'cardinality': {
                            'field': 'package.countryCode.keyword',
                        },
                    },
                },
            }
            aggregations = self.es.search(index=self.index_name,
                                          body=query)['aggregations']

            return {
                key: int(value['value'])
                for key, value in aggregations.items()
            }
        except NotFoundError:
            return {}
1109809
def get_json_views(self, item=None, key=None, option=None):
        """"""
        return self._json_dumps(self.get_views(item, key, option))
815790
def _context_views(self):
        """"""
        possible_views = []

        for func in self._func_contexts:
            if self._context_satified(func):
                logger.debug("{} context conditions satisified".format(func.__name__))
                possible_views.append(func)
        return possible_views
1242952
def _the_view_kwd(self, postinfo):
        '''
        
        '''
        kwd = {
            'pager': '',
            'url': self.request.uri,
            'cookie_str': tools.get_uuid(),
            'daohangstr': '',
            'signature': postinfo.uid,
            'tdesc': '',
            'eval_0': MEvaluation.app_evaluation_count(postinfo.uid, 0),
            'eval_1': MEvaluation.app_evaluation_count(postinfo.uid, 1),
            'login': 1 if self.get_current_user() else 0,
            'has_image': 0,
            'parentlist': MCategory.get_parent_list(),
            'parentname': '',
            'catname': '',
            'router': router_post[postinfo.kind]
        }
        return kwd
88798
def update_views(self):
        """"""
        # Call the father's method
        super(Plugin, self).update_views()

        # Add specifics informations
        # Optional
        for key in iterkeys(self.stats):
            self.views[key]['optional'] = True
1008213
def get_view(self, view_name):
        
        return self.measure_to_view_map.get_view(view_name=view_name,
                                                 timestamp=self.time)
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
810956
def get_statistics(self):
        
        return {
            'cumulative_elapsed_time': self.get_cumulative_elapsed_time(),
            'percentage': self.get_percentage(),
            'n_splits': self.get_n_splits(),
            'mean_per_split': self.get_mean_per_split(),
        }
821596
def check_views(view_set, max_views=3):
    """"""

    if not isinstance(view_set, Iterable):
        view_set = tuple([view_set, ])

    if len(view_set) > max_views:
        raise ValueError('Can only have {} views'.format(max_views))

    return [check_int(view, 'view', min_value=0, max_value=max_views - 1) for view in view_set]
743589
def __display_stats(self):
        """"""

        self.display('unify.tmpl', processed=self.total,
                     matched=self.matched,
                     unified=self.total - self.matched)
199153
def process_view(self, request, view_func, view_args, view_kwargs):
        """"""
        profiler = getattr(request, 'profiler', None)
        if profiler:
            # Make sure profiler variables don't get passed into view_func
            original_get = request.GET
            request.GET = original_get.copy()
            request.GET.pop('profile', None)
            request.GET.pop('show_queries', None)
            request.GET.pop('show_stats', None)
            try:
                return profiler.runcall(
                    view_func, request, *view_args, **view_kwargs
                )
            finally:
                request.GET = original_get