Some labels currently don't work together because of LaTeX naming
       clashes. Those will be replaced by simple strings.
557868
def filter_label(label, replace_by_similar=True):
    
    bad_names = ['celsius', 'degree', 'ohm', 'venus', 'mars', 'astrosun',
                 'fullmoon', 'leftmoon', 'female', 'male', 'checked',
                 'diameter', 'sun', 'Bowtie', 'sqrt',
                 'cong', 'copyright', 'dag', 'parr', 'notin', 'dotsc',
                 'mathds', 'mathfrak']
    if any(label[1:].startswith(bad) for bad in bad_names):
        if label == '\\dag' and replace_by_similar:
            return '\\dagger'
        elif label == '\\diameter' and replace_by_similar:
            return '\\O'
        return label[1:]
    else:
        return 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
1212164
def labels(self, labels):
        
        allowed_values = ["raw data", "documentation", "visualization", "clean data", "script", "report"]
        if not set(labels).issubset(set(allowed_values)):
            raise ValueError(
                "Invalid values for `labels` [{0}], must be a subset of [{1}]"
                .format(", ".join(map(str, set(labels)-set(allowed_values))),
                        ", ".join(map(str, allowed_values)))
            )

        self._labels = labels
1000927
def fix_e112(self, result):
        """"""
        line_index = result['line'] - 1
        target = self.source[line_index]

        if not target.lstrip().startswith('#'):
            # Don't screw with invalid syntax.
            return []

        self.source[line_index] = self.indent_word + target
1243823
def _replace_labels(doc):
    """"""
    lines = doc.splitlines()
    labelstart, labelend = None, None
    foundattributes = False
    for i, line in enumerate(lines):
        stripped = line.strip()
        if stripped == 'Attributes':
            foundattributes = True
        if foundattributes and not labelstart and stripped.startswith('labels_'):
            labelstart = len('\n'.join(lines[:i])) + 1
        if labelstart and not labelend and stripped == '':
            labelend = len('\n'.join(lines[:i + 1]))

    if labelstart is None or labelend is None:
        return doc

    replace = '\n'.join([
        '    labels_ : list of arrays, each of shape [sequence_length, ]',
        '        The label of each point is an integer in [0, n_clusters).',
        '',
    ])
    return doc[:labelstart] + replace + doc[labelend:]
294345
protected String cleanUpLabel(String label) {
    if (label == null) {
      return "";  // This shouldn't really happen, but can happen if there are unlabeled nodes further down a tree, as apparently happens in at least the 20100730 era American National Corpus
    }
    boolean nptemp = NPTmpPattern.matcher(label).matches();
    boolean npadv = NPAdvPattern.matcher(label).matches();
    label = tlp.basicCategory(label);
    if (nptemp) {
      label = label + "-TMP";
    } else if (npadv) {
      label = label + "-ADV";
    }
    return label;
  }
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)
4947
def calculte_tensor_to_label_output_shapes(operator):
    '''
    
    '''
    check_input_and_output_numbers(operator, input_count_range=1, output_count_range=1)
    check_input_and_output_types(operator, good_input_types=[FloatTensorType])

    N = operator.inputs[0].type.shape[0]
    if operator.target_opset < 7:
        output_shape = [1, 1]
    else:
        output_shape = [N, 1]

    if type(operator.outputs[0].type) in [Int64Type, Int64TensorType]:
        operator.outputs[0].type = Int64TensorType(output_shape, doc_string=operator.outputs[0].type.doc_string)
    elif type(operator.outputs[0].type) in [StringType, StringTensorType]:
        operator.outputs[0].type = StringTensorType(output_shape, doc_string=operator.outputs[0].type.doc_string)
    else:
        raise ValueError('Unsupported label type')
1307515
function camelize(label) {

  if (label.length === 0)
    return label;

  var n, result, word, words = label.split(/[_-]/);

  // single word with first character already lowercase, return untouched
  if ((words.length === 1) && (words[0][0].toLowerCase() === words[0][0]))
    return label;

  result = words[0].toLowerCase();
  for(n = 1 ; n < words.length ; n++) {
    result = result + words[n].charAt(0).toUpperCase() + words[n].substring(1).toLowerCase();
  }

  return result;
}
637323
def labels(self, values):
        """"""
        if isinstance(values, dict):
            if self.__data is not None and len(self.__data) != len(values):
                raise ValueError(
                    'number of samples do not match the previously assigned data')
            elif set(self.keys) != set(list(values)):
                raise ValueError('sample ids do not match the previously assigned ids.')
            else:
                self.__labels = values
        else:
            raise ValueError('labels input must be a dictionary!')
45462
def generate_entry_label(entry):
    
    if isinstance(entry, MultiEntry):
        return " + ".join([latexify_ion(e.name) for e in entry.entry_list])
    else:
        return latexify_ion(latexify(entry.name))
622654
def _fix_labels(self):
        
        for s in self.systems:
            mag0 = np.inf
            n0 = None
            for n in self.get_system(s):
                if isinstance(n.parent, DummyObsNode):
                    continue
                mag, _ = n.parent.value
                if mag < mag0:
                     mag0 = mag
                     n0 = n

            # If brightest is not tag _0, then switch them.
            if n0 is not None and n0.tag != 0:
                n_other = self.get_leaf('{}_{}'.format(s,0))
                n_other.tag = n0.tag
                n0.tag = 0
1305847
def get_labels(labels):
    """"""
    label_u = unique_labels(labels)
    label_u_line = [i + "_line" for i in label_u]
    return label_u, label_u_line
699833
def p_else_part_label(p):
    
    lbl = make_label(p[1], p.lineno(1))
    p[0] = [make_block(lbl, p[3]), p[4]]
734881
def _label_suffix(label, suffix):
    
    if len(label) > 50:
        nhead = 25
        return ''.join([label[:nhead], '..', suffix])
    else:
        return label + suffix
765336
def __set_labels(self, labels):
        
        with self.fs.open(self.fs.join(self.path, self.LABEL_FILE), 'w') \
                as file_desc:
            for label in labels:
                file_desc.write("%s,%s\n" % (label.name,
                                             label.get_color_str()))
176976
def flatten_binary_scores(scores, labels, ignore=None):
    
    scores = scores.view(-1)
    labels = labels.view(-1)
    if ignore is None:
        return scores, labels
    valid = (labels != ignore)
    vscores = scores[valid]
    vlabels = labels[valid]
    return vscores, vlabels