Create a concatenated string of author names. Separate names with semi-colons.
    :param any pub: Publication author structure is ambiguous
    :param int idx: Index number of Pub
13893
def _extract_authors(pub, idx, _root):
    
    logger_ts.info("enter extract_authors")
    try:
        # DOI Author data. We'd prefer to have this first.
        names = pub['author']
    except KeyError as e:
        try:
            # Manually entered author data. This is second best.
            names = pub['authors']
        except KeyError as e:
            # Couldn't find any author data. Skip it altogether.
            names = False
            logger_ts.info("extract_authors: KeyError: author data not provided, {}".format(e))

    # If there is author data, find out what type it is
    if names:
        # Build author names onto empty string
        auth = ''
        # Is it a list of dicts or a list of strings? Could be either
        # Authors: Stored as a list of dictionaries or list of strings
        if isinstance(names, list):
            for name in names:
                if isinstance(name, str):
                    auth += name + ';'
                elif isinstance(name, dict):
                    for k, v in name.items():
                        auth += v + ';'
        elif isinstance(names, str):
            auth = names
        # Enter finished author string into target
        _root['pub' + str(idx + 1) + '_author'] = auth[:-1]
    return _root
746093
def _join_names(names):
    """"""

    levels = (str(name) for name in names if name != '')
    return '_'.join(levels)
669303
def get_pub_id(title, authors, year):
    ""
    if len(title.split(' ')) > 1 \
       and title.split(' ')[0].lower() in ['the', 'a']:
        _first_word = title.split(' ')[1].split('_')[0]
    else:
        _first_word = title.split(' ')[0].split('_')[0]

    pub_id = authors[0].split(',')[0].split(' ')[0] + \
        _first_word + \
        str(year)
    return pub_id
1059768
function parseInput(str, idx) {
  var raw = String(str || '');
  var sliced = raw.slice(0, idx);
  var sections = sliced.split('|');
  var prefix = sections.slice(0, sections.length - 1) || [];
  prefix.push('');
  prefix = prefix.join('|');
  var suffix = getSuffix(raw.slice(idx));
  var context = sections[sections.length - 1];
  return {
    raw: raw,
    prefix: prefix,
    suffix: suffix,
    context: context
  };
}
1038639
function(name, idx) {
    var header, value, parsed;

    name = Utils.headerize(name);

    idx = idx || 0;

    if(!this.headers[name]) {
      debug('header "' + name + '" not present');
      return;
    } else if(idx >= this.headers[name].length) {
      debug('not so many "' + name + '" headers present');
      return;
    }

    header = this.headers[name][idx];
    value = header.raw;

    if(header.parsed) {
      return header.parsed;
    }

    //substitute '-' by '_' for grammar rule matching.
    parsed = Grammar.parse(value, name.replace(/-/g, '_'));

    if(parsed === -1) {
      this.headers[name].splice(idx, 1); //delete from headers
      debug('error parsing "' + name + '" header field with value "' + value + '"');
      return;
    } else {
      header.parsed = parsed;
      return parsed;
    }
  }
974138
def _process_pubmed_ids(pubmed_ids):
        
        if pubmed_ids.strip() == '':
            id_list = []
        else:
            id_list = pubmed_ids.split('|')
        for (i, val) in enumerate(id_list):
            id_list[i] = 'PMID:' + val
        return id_list
633836
def author_structure(user):
    
    return {'user_id': user.pk,
            'user_login': user.get_username(),
            'display_name': user.__str__(),
            'user_email': user.email}
383471
def make_heading_authors(self, authors):
        
        author_element = etree.Element('h3', {'class': 'authors'})
        #Construct content for the author element
        first = True
        for author in authors:
            if first:
                first = False
            else:
                append_new_text(author_element, ',', join_str='')
            collab = author.find('collab')
            anon = author.find('anon')
            if collab is not None:
                append_all_below(author_element, collab)
            elif anon is not None:  # If anonymous, just add "Anonymous"
                append_new_text(author_element, 'Anonymous')
            else:  # Author is neither Anonymous or a Collaboration
                author_name, _ = self.get_contrib_names(author)
                append_new_text(author_element, author_name)
            #TODO: Handle author footnote references, also put footnotes in the ArticleInfo
            #Example: journal.pbio.0040370.xml
            first = True
            for xref in author.xpath("./xref[@ref-type='corresp' or @ref-type='aff']"):
                _sup = xref.find('sup')
                sup_text = all_text(_sup) if _sup is not None else ''
                auth_sup = etree.SubElement(author_element, 'sup')
                sup_link = etree.SubElement(auth_sup,
                                            'a',
                                            {'href': self.main_fragment.format(xref.attrib['rid'])})
                sup_link.text = sup_text
                if first:
                    first = False
                else:
                    append_new_text(auth_sup, ', ', join_str='')
            #for xref in author.findall('xref'):
                #if xref.attrs['ref-type'] in ['corresp', 'aff']:

                    #try:
                        #sup_element = xref.sup[0].node
                    #except IndexError:
                        #sup_text = ''
                    #else:
                        #sup_text = all_text(sup_element)
                    #new_sup = etree.SubElement(author_element, 'sup')
                    #sup_link = etree.SubElement(new_sup, 'a')
                    #sup_link.attrib['href'] = self.main_fragment.format(xref.attrs['rid'])
                    #sup_link.text = sup_text
                    #if first:
                        #first = False
                    #else:
                        #new_sup.text = ','
        return author_element
333667
def _idx_table_by_name(tables, crumbs):
    
    _tables = OrderedDict()
    try:
        for _idx, _table in enumerate(tables):
            # Use "name" as tableName
            _name = "{}{}".format(crumbs, _idx)
            # Call idx_table_by_name
            _tmp = _idx_col_by_name(_table)
            if _name in _tables:
                _name = "{}_{}".format(_name, _idx)
            _tmp["tableName"] = _name
            _tables[_name] = _tmp
    except Exception as e:
        logger_jsons.error("idx_table_by_name: {}".format(e))
        print("Error: idx_table_by_name: {}".format(e))

    return _tables
1057702
def _collapse_author(s):
    
    logger_ts.info("enter collapse_author")
    l = []
    authors = s.split(';')
    for author in authors:
        l.append({'name': author})
    return l
165488
private String pubMedURL(int rowIndex){

        if(params.length != 2){
            throw new IllegalArgumentException("Wrong number of Parameters for limit string expression");
        }

        final RecordList.Record currentRecord = recordList.getRecords().get(rowIndex);
        final String title = currentRecord.getValueByFieldName(params[0]);
        String pubMedId = currentRecord.getValueByFieldName(params[1]);

        if (pubMedId.isEmpty()){
            return title;
        }

        String result = "<a href=" + "http://www.ncbi.nlm.nih.gov/pubmed/"+pubMedId+" target=_blank>"+title+"</a>";
        return result;
    }
328845
def _split_refextract_authors_str(authors_str):
    """"""
    author_seq = (x.strip() for x in RE_SPLIT_AUTH.split(authors_str) if x)
    res = []

    current = ''
    for author in author_seq:
        if not isinstance(author, six.text_type):
            author = six.text_type(author.decode('utf8', 'ignore'))

        # First clean the token.
        author = re.sub(r'\(|\)', '', author, re.U)
        # Names usually start with characters.
        author = re.sub(r'^[\W\d]+', '', author, re.U)
        # Names should end with characters or dot.
        author = re.sub(r'[^.\w]+$', '', author, re.U)

        # If we have initials join them with the previous token.
        if RE_INITIALS_ONLY.match(author):
            current += ', ' + author.strip().replace('. ', '.')
        else:
            if current:
                res.append(current)
            current = author

    # Add last element.
    if current:
        res.append(current)

    # Manual filterings that we don't want to add in regular expressions since
    # it would make them more complex.
    #  * ed might sneak in
    #  * many legacy refs look like 'X. and Somebody E.'
    #  * might miss lowercase initials
    filters = [
        lambda a: a == 'ed',
        lambda a: a.startswith(','),
        lambda a: len(a) == 1
    ]
    res = [r for r in res if all(not f(r) for f in filters)]
    return res
1262263
def name_append_suffix(records, suffix):
    
    logging.info('Applying _name_append_suffix generator: '
                 'Appending suffix ' + suffix + ' to all '
                 'sequence IDs.')
    for record in records:
        new_id = record.id + suffix
        _update_id(record, new_id)
        yield record
495076
def __get_author_last_name(author):
        
        _author = ""
        if isinstance(author, str):
            try:
                # example:   'Ahmed, Moinuddin and Anchukaitis, Kevin J and ...'
                # If this is a list of authors, try to split it and just get the first author.
                if " and " in author:
                    _author = author.split(" and ")[0]
                # 'Ahmed, Moinuddin; Anchukaitis, Kevin J;  ...'
                elif ";" in author:
                    _author = author.split(";")[0]
            except Exception:
                _author = ""
            try:
                # example :  'Ahmed Moinuddin,  Anchukaitis Kevin J,  ...'
                _author = author.replace(" ", "")
                if "," in author:
                    _author = author.split(",")[0]
            except Exception:
                _author = ""
        elif isinstance(author, list):
            try:
                # example:  [{'name': 'Ahmed, Moinuddin'}, {'name': 'Anchukaitis, Kevin J.'}, ..]
                # just get the last name of the first author. this could get too long.
                _author = author[0]["name"].split(",")[0]
            except Exception as e:
                _author = ""

        return _author
852163
def postprocess_authorKeywords(self, entry):
        

        if type(entry.authorKeywords) not in [str, unicode]:
            aK = u' '.join([unicode(k) for k in entry.authorKeywords])
        else:
            aK = entry.authorKeywords
        entry.authorKeywords = [k.strip().upper() for k in aK.split(';')]
738072
def make_heading_affiliations(self, heading_div):
        
        #Get all of the aff element tuples from the metadata
        affs = self.article.root.xpath('./front/article-meta/aff')
        #Create a list of all those pertaining to the authors
        author_affs = [i for i in affs if 'aff' in i.attrib['id']]
        #Count them, used for formatting
        if len(author_affs) == 0:
            return None
        else:
            affs_list = etree.SubElement(heading_div,
                                         'ul',
                                         {'id': 'affiliations',
                                          'class': 'simple'})

        for aff in author_affs:
            #Create a span element to accept extracted content
            aff_item = etree.SubElement(affs_list, 'li')
            aff_item.attrib['id'] = aff.attrib['id']
            #Get the first label node and the first addr-line node
            label = aff.find('label')
            addr_line = aff.find('addr-line')
            if label is not None:
                bold = etree.SubElement(aff_item, 'b')
                bold.text = all_text(label) + ' '
            if addr_line is not None:
                append_new_text(aff_item, all_text(addr_line))
            else:
                append_new_text(aff_item, all_text(aff))
1371761
def build_index(self, idx_name, _type='default'):
        ""
        indexes = {}
        has_non_string_values = False
        for key, item in self.data.items():
            if idx_name in item:
                value = item[idx_name]
                # A non-string index value switches it into a lazy one.
                if not isinstance(value, six.string_types):
                    has_non_string_values = True
                if value not in indexes:
                    indexes[value] = set([])
                indexes[value].add(key)
        self.indexes[idx_name] = indexes
        if self._meta.lazy_indexes or has_non_string_values:
            # Every index is lazy
            _type = 'lazy'
        self.index_defs[idx_name] = {'type': _type}