Method to translate the Stats instance/group name. Used by Admin Console
482254
public static String getTranslatedStatsName(String statsName, String statsType) {
        return getTranslatedStatsName(statsName, statsType, Locale.getDefault());
    }
24845
def stats(options = {})
      raise ArgumentError, '#stats requires a stats arg' unless options[:stats]
      raise ArgumentError, '#stats requires a group arg' unless options[:group]

      get '/stats', options
    end
1212073
def _groupname():
    '''
    
    '''
    if grp:
        try:
            groupname = grp.getgrgid(os.getgid()).gr_name
        except KeyError:
            groupname = ''
    else:
        groupname = ''

    return groupname
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
231781
def translate(self):
        """"""
        ident = self.ident
        expr = ex_rvalue(VARIABLE_PREFIX + ident)
        return [expr], set([ident]), set()
585061
def cli(obj):
    """"""
    client = obj['client']
    metrics = client.mgmt_status()['metrics']
    headers = {'title': 'METRIC', 'type': 'TYPE', 'name': 'NAME', 'value': 'VALUE', 'average': 'AVERAGE'}
    click.echo(tabulate([{
        'title': m['title'],
        'type': m['type'],
        'name': '{}.{}'.format(m['group'], m['name']),
        'value': m.get('value', None) or m.get('count', 0),
        'average': int(m['totalTime']) * 1.0 / int(m['count']) if m['type'] == 'timer' else None
    } for m in metrics], headers=headers, tablefmt=obj['output']))
150446
def translate_tab(data):
    
    tab_str = ""
    sections = data.get("Sections", [])
    for section in sections:
            print("  Translating " + section["Type"])
            tab_str += translate_map[section["Type"]](section)
    return tab_str
651118
def _count_localizations(df):
    
    grp = df.groupby(_index_columns)
    counts = grp['DP AA'].apply(lambda x: count(x.str.split(';').values))
    counts.index = counts.index.set_names('DP AA', level=4)
    counts.name = 'DP AA count'
    best_localization = counts.reset_index().groupby(_index_columns).apply(_frequent_localizations)
    return best_localization
111311
def translate_command(val):
    '''
    
    '''
    if isinstance(val, six.string_types):
        return val
    elif isinstance(val, list):
        for idx in range(len(val)):
            if not isinstance(val[idx], six.string_types):
                val[idx] = six.text_type(val[idx])
    else:
        # Make sure we have a string
        val = six.text_type(val)
    return val
143403
def get_stats_summary_dict(self):
        
        uptime = time.time() - self._established_time \
            if self._established_time != 0 else -1
        return {
            stats.UPDATE_MSG_IN: self.get_count(PeerCounterNames.RECV_UPDATES),
            stats.UPDATE_MSG_OUT: self.get_count(
                PeerCounterNames.SENT_UPDATES
            ),
            stats.TOTAL_MSG_IN: self.total_msg_recv,
            stats.TOTAL_MSG_OUT: self.total_msg_sent,
            stats.FMS_EST_TRANS: self.get_count(
                PeerCounterNames.FSM_ESTB_TRANSITIONS
            ),
            stats.UPTIME: uptime
        }
758181
def _get_stats_column_names(cls):
        
        columns = []
        stats = ('num_bytes', 'num_rows', 'location', 'partitioning_type',
                 'clustering_fields')
        stat_components = ('label', 'value', 'description', 'include')
        for stat_id in stats:
            for stat_component in stat_components:
                columns.append('stats:{}:{}'.format(stat_id, stat_component))
        return tuple(columns)
326186
function (metricType, statsdKey) {
                statsdKey = statsdKey.replace(/([^a-zA-Z0-9:_])/g, '_');
                return [prefixes[metricType], '_', statsdKey].join('');
            }
299339
function getEtag(stats) {
  let mtime = stats.mtime.getTime().toString(16)
  let size = stats.size.toString(16)
  return `"${size}-${mtime}"`
}
1151567
def translate(patterns, *, flags=0):
    """"""

    flags = _flag_transform(flags)
    return _wcparse.translate(_wcparse.split(patterns, flags), flags)
392351
def display_movements_stats(ct, base_assignment):
    
    movement_count, movement_size, leader_changes = \
        stats.get_partition_movement_stats(ct, base_assignment)
    print(
        'Total partition movements: {movement_count}\n'
        'Total partition movement size: {movement_size}\n'
        'Total leader changes: {leader_changes}'
        .format(
            movement_count=movement_count,
            movement_size=movement_size,
            leader_changes=leader_changes,
        )
    )
1168497
def get_translation_from_instance(instance, lang):
        
        try:
            translation = get_translation(instance, lang)
        except (AttributeError, ObjectDoesNotExist):
            translation = None
        return translation
1336016
def _translate_timeperiod(self, timeperiod):
        
        if self.time_grouping == 1:
            # no translation is performed for identity grouping
            return timeperiod

        # step 1: tokenize timeperiod into: (year, month, day, hour)
        # for instance: daily 2015031400 -> ('2015', '03', '14', '00')
        year, month, day, hour = time_helper.tokenize_timeperiod(timeperiod)

        # step 2: perform grouping on the stem
        # ex1: stem of 14 with grouping 20 -> 20
        # ex2: stem of 21 with grouping 20 -> 23
        if self.time_qualifier == QUALIFIER_HOURLY:
            stem = self._do_stem_grouping(timeperiod, int(hour))
            result = '{0}{1}{2}{3:02d}'.format(year, month, day, stem)
        elif self.time_qualifier == QUALIFIER_DAILY:
            stem = self._do_stem_grouping(timeperiod, int(day))
            result = '{0}{1}{2:02d}{3}'.format(year, month, stem, hour)
        else:  # self.time_qualifier == QUALIFIER_MONTHLY:
            stem = self._do_stem_grouping(timeperiod, int(month))
            result = '{0}{1:02d}{2}{3}'.format(year, stem, day, hour)
        return result