Convert descriptions into names
498850
def write(self, descrs):
        
        # example: '(poe-[\d\.]+):float32' -> 'poe-[\d\.]+'
        names = []
        for descr in descrs:
            mo = re.match(self.long_regex, descr)
            if mo:
                names.append(mo.group(mo.lastindex) + descr[mo.end():])
            else:
                names.append(descr)
        return names
118694
def to_names(scope):
    
    return [
        name
        for (name, value) in SCOPE_NAME_DICT.iteritems()
        if check(value, scope)
    ]
348593
def get_arg_descriptions_from_docstring(cls, obj):
    """"""

    ret = OrderedDict()
    name = ''
    doc = obj.__doc__ or ''
    lines = [s.strip() for s in doc.split('\n')]
    stanza_first_line_re = cls._get_stanza_first_line_re()
    for line in lines:
      m = stanza_first_line_re.match(line)
      if m and m.group(1) == 'param':
        # If first line of a parameter description, set name and description.
        name, description = m.group(3, 4)
        ret[name] = description
      elif m and m.group(1) != 'param':
        # If first line of a description of an item other than a parameter, clear name.
        name = ''
      elif name and line:
        # If subsequent line of a parameter description, add to existing description (if any) for
        # that parameter.
        ret[name] += (' ' + line) if ret[name] else line
      # Ignore subsequent lines of descriptions of items other than parameters.
    return ret
763714
def make_describe_attrs(self):
        """"""
        lst = []
        if self.all_groups:
            lst.append((NEWLINE, '\n'))
            lst.append((INDENT, ''))

            for group in self.all_groups:
                if group.name:
                    lst.extend(self.tokens.make_describe_attr(group.kls_name))

        return lst
569645
def title_to_name(title, decode=True, max_len=None, use_complete_words=True):
    """"""
    # decodifica y pasa a minúsculas
    if decode:
        title = unidecode(title)
    title = title.lower()

    # remueve caracteres no permitidos
    filtered_title = re.sub(r'[^a-z0-9- ]+', '', title)

    # remueve stop words y espacios y une palabras sólo con un "-"
    normalized_title = '-'.join([word for word in filtered_title.split()
                                 if word not in STOP_WORDS])

    # recorto el titulo normalizado si excede la longitud máxima
    if max_len and len(normalized_title) > max_len:

        # busco la última palabra completa
        if use_complete_words:
            last_word_index = normalized_title.rindex("-", 0, max_len)
            normalized_title = normalized_title[:last_word_index]

        # corto en el último caracter
        else:
            normalized_title = normalized_title[:max_len]

    return normalized_title
135942
def _import_string(names):
    """"""
    _names = []
    for name, asname in names:
        if asname is not None:
            _names.append("%s as %s" % (name, asname))
        else:
            _names.append(name)
    return ", ".join(_names)
654960
def _clean_rec_name(rec):
    
    out_id = []
    for char in list(rec.id):
        if char in ALLOWED_CONTIG_NAME_CHARS:
            out_id.append(char)
        else:
            out_id.append("_")
    rec.id = "".join(out_id)
    rec.description = ""
    return rec
292464
def description(self):
        """"""
        lines = []
        for line in self.__doc__.split('\n')[2:]:
            line = line.strip()
            if line:
                lines.append(line)
        return ' '.join(lines)
625585
def format_description(self, description):
        
        if not description: return ""
        desc_width = self.width - self.current_indent
        indent = " "*self.current_indent
        # the above is still the same
        bits = description.split('\n')
        formatted_bits = [
            textwrap.fill(bit,
                desc_width,
                initial_indent=indent,
                subsequent_indent=indent)
            for bit in bits]
        result = "\n".join(formatted_bits) + "\n"
        return result
625943
def _to_spans(x):
    """"""
    if isinstance(x, Candidate):
        return [_to_span(m) for m in x]
    elif isinstance(x, Mention):
        return [x.context]
    elif isinstance(x, TemporarySpanMention):
        return [x]
    else:
        raise ValueError(f"{type(x)} is an invalid argument type")
827882
def _get_names(names, types):
    
    if types == "":
        try:
            names, types = names.split(":")
        except:
            pass
    return names.split(","), types
334875
def Describe(self):
    """"""
    result = ["\nUsername: %s" % self.urn.Basename()]
    labels = [l.name for l in self.GetLabels()]
    result.append("Labels: %s" % ",".join(labels))

    if self.Get(self.Schema.PASSWORD) is None:
      result.append("Password: not set")
    else:
      result.append("Password: set")

    return "\n".join(result)
143880
private StringBuilder makeDescription(Collection<Relation<?>> relations, DBIDRef id) {
    StringBuilder buf = new StringBuilder();
    for(Relation<?> rel : relations) {
      Object o = rel.get(id);
      if(o == null) {
        continue;
      }
      String s = o.toString();
      // FIXME: strip html characters
      if(s != null) {
        if(buf.length() > 0) {
          buf.append("<br />");
        }
        buf.append(s);
      }
    }
    return buf;
  }
987511
def generate_headline_from_description(sender, instance, *args, **kwargs):
    '''
    
    '''
    lines = instance.description.split('\n')
    headline = truncatewords(lines[0], 20)
    if headline[:-3] == '...':
        headline = truncatechars(headline.replace(' ...', ''), 250)  # Just in case the words exceed char limit.
    else:
        headline = truncatechars(headline, 250)
    instance.headline = headline
859007
def sub_description(self):
        """"""
        gd = self.geo_description
        td = self.time_description

        if gd and td:
            return '{}, {}. {} Rows.'.format(gd, td, self._p.count)
        elif gd:
            return '{}. {} Rows.'.format(gd, self._p.count)
        elif td:
            return '{}. {} Rows.'.format(td, self._p.count)
        else:
            return '{} Rows.'.format(self._p.count)
1337408
def fnames(self, names):
        """"""
        names = list(names[:len(self._fnames)])
        self._fnames = names + self._fnames[len(names):]
585833
def _get_names(self):
        
        for line in self.content:
            line = line.strip()
            if line and re.search("^[a-zA-Z0-9]", line):
                yield line