Get the dict with the basic fields used to describe a metrics: id, name and desc
        :return: a dict with the definition
552571
def get_definition(self):
        
        def_ = {
            "id": self.id,
            "name": self.name,
            "desc": self.desc
        }
        return def_
259430
def _metric_names_for_training_job(self):
        
        training_description = self._sage_client.describe_training_job(TrainingJobName=self._training_job_name)

        metric_definitions = training_description['AlgorithmSpecification']['MetricDefinitions']
        metric_names = [md['Name'] for md in metric_definitions]

        return metric_names
1151859
def get(self, id=None, **kwargs):
        
        if id is not None:
            return self._get('metrics/%s' % id, data=kwargs)
        else:
            return self._get('metrics', data=kwargs)
512503
def get_branding_metadata(self):
        
        metadata = dict(self._branding_metadata)
        metadata.update({'existing_id_values': self.my_osid_object_form._my_map['brandingIds']})
        return Metadata(**metadata)
1151948
def to_dict(self):
        
        obj = {
            'id' : self.identifier,
            'name' : self.name,
            'description' : self.description,
            'type' : self.data_type.to_dict()
        }
        if not self.default is None:
            obj['default'] = self.default
        return obj
48480
def to_dict(self):
        
        jdict = {
            'user': self.user,
            'summary': self.summary,
            'body': self.body,
            'markup': self.markup,
            'url': self.url,
            'timestamp': self.timestamp
            }
        return jdict
388007
def get_context_data(self, **kwargs):
        """"""
        data = super(MetricsListView, self).get_context_data(**kwargs)

        # Metrics organized by category, like so:
        # { <category_name>: [ <slug1>, <slug2>, ... ]}
        data.update({'metrics': get_r().metric_slugs_by_category()})
        return data
699500
def metric_detail(slug, with_data_table=False):
    
    r = get_r()
    granularities = list(r._granularities())
    metrics = r.get_metric(slug)
    metrics_data = []
    for g in granularities:
        metrics_data.append((g, metrics[g]))

    return {
        'granularities': [g.title() for g in granularities],
        'slug': slug,
        'metrics': metrics_data,
        'with_data_table': with_data_table,
    }
910087
def asDictionary(self):
        
        template = {
            "type" : "uniqueValue",
            "field1" : self._field1,
            "field2" : self._field2,
            "field3" : self._field3,
            "fieldDelimiter" : self._fieldDelimiter,
            "defaultSymbol" :  self._defaultSymbol.asDictionary,
            "defaultLabel" : self._defaultLabel,
            "uniqueValueInfos" : self._uniqueValueInfos,
            "rotationType": self._rotationType,
            "rotationExpression": self._rotationExpression
        }
        return template
210667
def describe(self):
        
        return {
            "name": self.name,
            "params": self.params,
            "returns": self.returns,
            "description": self.description,
        }
1144641
def as_dict(self):
        
        return {self.FLD_OP: self._op.name,
                self.FLD_MARK: self._pos,
                self.FLD_FLD: self._fld}
26781
def to_dict(self):
        ''''''
        d = {'name': self.name}
        if self.data:
            d['data'] = self.data
        return d
722919
def __schemas_descriptor(self):
    
    # Filter out any keys that aren't 'properties', 'type', or 'id'
    result = {}
    for schema_key, schema_value in self.__parser.schemas().iteritems():
      field_keys = schema_value.keys()
      key_result = {}

      # Some special processing for the properties value
      if 'properties' in field_keys:
        key_result['properties'] = schema_value['properties'].copy()
        # Add in enumDescriptions for any enum properties and strip out
        # the required tag for consistency with Java framework
        for prop_key, prop_value in schema_value['properties'].iteritems():
          if 'enum' in prop_value:
            num_enums = len(prop_value['enum'])
            key_result['properties'][prop_key]['enumDescriptions'] = (
                [''] * num_enums)
          elif 'default' in prop_value:
            # stringify default values
            if prop_value.get('type') == 'boolean':
              prop_value['default'] = 'true' if prop_value['default'] else 'false'
            else:
              prop_value['default'] = str(prop_value['default'])
          key_result['properties'][prop_key].pop('required', None)

      for key in ('type', 'id', 'description'):
        if key in field_keys:
          key_result[key] = schema_value[key]

      if key_result:
        result[schema_key] = key_result

    # Add 'type': 'object' to all object properties
    for schema_value in result.itervalues():
      for field_value in schema_value.itervalues():
        if isinstance(field_value, dict):
          if '$ref' in field_value:
            field_value['type'] = 'object'

    return result
183557
def to_dict(self, remove_nones=False):
        

        if remove_nones:
            return super().to_dict(remove_nones=True)

        return {
            'id': self.id,
            'name': self.name,
            'type': self.type
        }
921697
def json(self):
        

        data = {
            "segment_name": self.segment_name,
            "formula": self.formula,
            "warnings": [w.json() for w in self.warnings],
            "model_params": self.model_params,
        }
        return data
1299803
def get_metrics(tag):
    
    if tag is None:
        return metrics.metrics_by_name_list(metrics.metrics())
    else:
        return metrics.metrics_by_tag(tag)
828103
def dict(self):
        
        return {k: getattr(self, k) for k in self.__class__.defaults}