Generate an unused label.
8584
def _unused_label(self, label):
        """"""
        original = label
        existing = self.labels
        i = 2
        while label in existing:
            label = '{}_{}'.format(original, i)
            i += 1
        return label
7371
private function cleanOriginalLabel($label)
    {
        $label = str_replace(LabelFilter::SEPARATOR_RECURSIVE_LABEL, ' - ', $label);
        $label = SafeDecodeLabel::decodeLabelSafe($label);
        return $label;
    }
881846
def generate(self, path, label):
        
        for filename in os.listdir(path):
            self[filename] = label
593068
def space_labels(document):
    """"""
    for label in document.xpath('.//bold'):
        # TODO: Make this more permissive to match chemical_label in parser
        if not label.text or not re.match('^\(L?\d\d?[a-z]?\):?$', label.text, re.I):
            continue
        parent = label.getparent()
        previous = label.getprevious()
        if previous is None:
            text = parent.text or ''
            if not text.endswith(' '):
                parent.text = text + ' '
        else:
            text = previous.tail or ''
            if not text.endswith(' '):
                previous.tail = text + ' '
        text = label.tail or ''
        if not text.endswith(' '):
            label.tail = text + ' '
    return document
413434
private int[] convertLabelsToInds(String... label)
	{
		int[] ind = new int[label.length];
		for (int i = 0; i < label.length; i++)
		{
			if (hasLabel(label[i]))
			{
				ind[i] = indexOf(label[i]);
			}
			else ind[i] = lastIndex + 1;
		}
		return ind;
	}
185355
def label(self, t):
        
        if self.labels is None:
            return None
        prev_label = None
        for l in self.labels:
            if l.time > t:
                break
            prev_label = l
        if prev_label is None:
            return None
        return prev_label.name
384331
def empty(self, duration):
        '''
        '''
        ann = super(DynamicLabelTransformer, self).empty(duration)
        ann.append(time=0, duration=duration, value=None)
        return ann
412325
def provide_label(self):
        """"""
        return [(k, tuple([self.batch_size] + list(v.shape[1:]))) for k, v in self.label]
884786
def _escapify(label):
    """"""
    text = ''
    for c in label:
        if c in _escaped:
            text += '\\' + c
        elif ord(c) > 0x20 and ord(c) < 0x7F:
            text += c
        else:
            text += '\\%03d' % ord(c)
    return text
820765
def emptyArray(key, add_label=None):
    """"""

    result = {
        'key': key,
        'startEmpty': True
    }
    if add_label is not None:
        result['add'] = add_label
        result['style'] = {'add': 'btn-success'}
    return result
943359
def RemoveLabels(self, labels_names, owner=None):
    """"""
    if owner is None and not self.token:
      raise ValueError("Can't remove label: No owner specified and "
                       "no access token available.")
    if isinstance(labels_names, string_types):
      raise ValueError("Label list can't be string.")

    owner = owner or self.token.username

    current_labels = self.Get(self.Schema.LABELS)
    for label_name in labels_names:
      label = rdf_aff4.AFF4ObjectLabel(name=label_name, owner=owner)
      current_labels.RemoveLabel(label)

    self.Set(self.Schema.LABELS, current_labels)
37994
def RemoveClientLabels(self, client_id, owner, labels):
    """"""
    labelset = self.labels.setdefault(client_id, {}).setdefault(owner, set())
    for l in labels:
      labelset.discard(utils.SmartUnicode(l))
193229
def remove_unused_grid_rc(self):
        """"""

        if 'columns' in self['layout']:
            ckeys = tuple(self['layout']['columns'].keys())
            for key in ckeys:
                value = int(key)
                if value > self.max_col:
                    del self['layout']['columns'][key]
        if 'rows' in self['layout']:
            rkeys = tuple(self['layout']['rows'].keys())
            for key in rkeys:
                value = int(key)
                if value > self.max_row:
                    del self['layout']['rows'][key]
1161741
def replace_labels(self, labels):
        
        url = self._build_url('labels', base_url=self._api)
        json = self._json(self._put(url, data=dumps(labels)), 200)
        return [Label(l, self) for l in json] if json else []
288106
def make_label(loss, key):
    ''''''
    algo, rate, mu, half, reg = key
    slots, args = ['{:.3f}', '{}', 'm={:.3f}'], [loss, algo, mu]
    if algo in 'SGD NAG RMSProp Adam ESGD'.split():
        slots.append('lr={:.2e}')
        args.append(rate)
    if algo in 'RMSProp ADADELTA ESGD'.split():
        slots.append('rmsh={}')
        args.append(half)
        slots.append('rmsr={:.2e}')
        args.append(reg)
    return ' '.join(slots).format(*args)
165211
def labels(self, hs_dims=None, prune=False):
        """"""
        if self.ca_as_0th:
            labels = self._cube.labels(include_transforms_for_dims=hs_dims)[1:]
        else:
            labels = self._cube.labels(include_transforms_for_dims=hs_dims)[-2:]

        if not prune:
            return labels

        def prune_dimension_labels(labels, prune_indices):
            """Get pruned labels for single dimension, besed on prune inds."""
            labels = [label for label, prune in zip(labels, prune_indices) if not prune]
            return labels

        labels = [
            prune_dimension_labels(dim_labels, dim_prune_inds)
            for dim_labels, dim_prune_inds in zip(labels, self._prune_indices(hs_dims))
        ]
        return labels
1180346
def missing_labels(self):
        

        return np.array(sorted(set(range(0, self.max_label + 1)).
                               difference(np.insert(self.labels, 0, 0))))