Return the dict of MetricGroupDefinition objects for this metrics
        context, by processing its 'metric-group-infos' property.
486408
def _setup_metric_group_definitions(self):
        
        # Dictionary of MetricGroupDefinition objects, by metric group name
        metric_group_definitions = dict()
        for mg_info in self.properties['metric-group-infos']:
            mg_name = mg_info['group-name']
            mg_def = MetricGroupDefinition(
                name=mg_name,
                resource_class=_resource_class_from_group(mg_name),
                metric_definitions=dict())
            for i, m_info in enumerate(mg_info['metric-infos']):
                m_name = m_info['metric-name']
                m_def = MetricDefinition(
                    index=i,
                    name=m_name,
                    type=_metric_type(m_info['metric-type']),
                    unit=_metric_unit_from_name(m_name))
                mg_def.metric_definitions[m_name] = m_def
            metric_group_definitions[mg_name] = mg_def
        return metric_group_definitions
16628
def info(name):
    '''
    
    '''
    if salt.utils.stringutils.contains_whitespace(name):
        raise SaltInvocationError('Group name cannot contain whitespace')
    try:
        # getgrnam seems to cache weirdly, so don't use it
        grinfo = next(iter(x for x in grp.getgrall() if x.gr_name == name))
    except StopIteration:
        return {}
    else:
        return _format_info(grinfo)
1272147
def _get_group_infos(self):
        
        if self._group_infos is None:
            self._group_infos = self._group_type.user_groups(
                self._ldap_user, self._group_search
            )

        return self._group_infos
318074
def __get_metrics(self):
        
        esfilters_closed = None
        esfilters_opened = None
        if self.esfilters:
            esfilters_closed = self.esfilters.copy()
            esfilters_opened = self.esfilters.copy()

        closed = self.closed_class(self.es_url, self.es_index,
                                   start=self.start, end=self.end,
                                   esfilters=esfilters_closed, interval=self.interval)
        opened = self.opened_class(self.es_url, self.es_index,
                                   start=self.start, end=self.end,
                                   esfilters=esfilters_opened, interval=self.interval)
        return (closed, opened)
6521
def get_metric(self, slug):
        
        results = OrderedDict()
        granularities = self._granularities()
        keys = self._build_keys(slug)
        for granularity, key in zip(granularities, keys):
            results[granularity] = self.r.get(key)
        return results
647450
def metrics_by_name_list(names):
    
    results = {}

    for name in names:
        # no lock - a metric could have been removed in the meanwhile
        try:
            results[name] = get(name)
        except InvalidMetricError:
            continue

    return results
451400
def query_metric_definition(self, metric_type, metric_id):
        
        return self._get(self._get_metrics_single_url(metric_type, metric_id))
1178709
def get_metrics(self):
        
        now = datetime.utcnow()
        metrics = set()
        for gauge in self.gauges.values():
            metrics.add(gauge.get_metric(now))
        return metrics
397868
def metric_parts(metric):
    """"""
    operator, met = resolve_metric_as_tuple(metric)
    return operator.name, met.name
1097346
def group_data(self):
        
        return GroupData(self.group_num,
                         self.group_name,
                         self.group_symbol,
                         self.group_variant)
548742
def get_queryset(self, request):
        """"""
        queryset = super(MetricGroupAdmin, self).get_queryset(request)
        # poor-man's DISTINCT ON for Sqlite3
        qs_values = queryset.values('id', 'name')
        # 2.7+ only :(
        # = {metric['name']: metric['id'] for metric in qs_values}
        distinct_names = {}
        for metric in qs_values:
            distinct_names[metric['name']] = metric['id']
        queryset = self.model.objects.filter(id__in=distinct_names.values())
        return queryset
255517
def retrieve_metrics(self):
        

        time = np.array(self.list_dates)
        if len(time) >= 1:
            time -= time[0]
        return {'time': time, 'index': self.list_iters,
                'values': self.list_cv_values}
664909
def as_dict(self):
        
        return {"@module": self.__class__.__module__,
                "@class": self.__class__.__name__,
                "distance_cutoff": float(self._distance_cutoff),
                "angle_cutoff": float(self._angle_cutoff),
                "additional_condition": int(self._additional_condition),
                "continuous_symmetry_measure_cutoff": float(self._continuous_symmetry_measure_cutoff),
                "symmetry_measure_type": self._symmetry_measure_type}
793350
def disable_metrics_collection(self, as_group, metrics=None):
        
        params = {'AutoScalingGroupName': as_group}

        if metrics:
            self.build_list_params(params, metrics, 'Metrics')
        return self.get_status('DisableMetricsCollection', params)
58918
def get_groups_data(self, groups):
        '''
        
        '''

        data = {}

        for group in groups:
            data.update(self.get_group_data(group))

        return data
399389
def group(self):
        
        if self.api and self.group_id:
            return self.api._get_group(self.group_id)
1076619
def get_context_data(self, **kwargs):
        """"""
        data = super(MetricDetailView, self).get_context_data(**kwargs)
        data['slug'] = kwargs['slug']
        data['granularities'] = list(get_r()._granularities())
        return data