namedtuple representing the author to whom correspondence should
        be addressed, in the form
        (surname, initials, organization, country, city_group).
347246
def correspondence(self):
        
        fields = 'surname initials organization country city_group'
        auth = namedtuple('Correspondence', fields)
        corr = self._head.get('correspondence')
        if corr is None:
            return None
        aff = corr.get('affiliation', {})
        try:
            org = aff['organization']
            if isinstance(org, dict):
                try:
                    org = org['$']
                except TypeError:  # Multiple names given
                    org = [d['$'] for d in org]
        except KeyError:
            org = None
        return auth(surname=corr.get('person', {}).get('ce:surname'),
                    initials=corr.get('person', {}).get('ce:initials'),
                    organization=org, country=aff.get('country'),
                    city_group=aff.get('city-group'))
468811
def greet(self, name, sleep=0):
        # type: (AName, ASleep) -> AGreeting
        """"""
        print("Manufacturing greeting...")
        sleep_for(sleep)
        greeting = "Hello %s" % name
        return greeting
1315483
def pluralize(data_type):
    
    known = {
             u"address": u"addresses", 
             u"company": u"companies"
    }
    if data_type in known.keys():
        return known[data_type]
    else:
        return u"%ss" % data_type
1184293
def as_namedtuple(self):
        
        d = self.as_dict()
        return namedtuple('ColorRegister', d.keys())(*d.values())
142666
def author_json_details(author, author_json, contributions, correspondence,
                        competing_interests, equal_contributions_map, present_address_data,
                        foot_notes_data, html_flag=True):
    # Configure the XML to HTML conversion preference for shorthand use below
    convert = lambda xml_string: xml_to_html(html_flag, xml_string)

    """"""
    if author_affiliations(author):
        author_json["affiliations"] = author_affiliations(author)

    # foot notes or additionalInformation
    if author_foot_notes(author, foot_notes_data):
        author_json["additionalInformation"] = author_foot_notes(author, foot_notes_data)

    # email
    if author_email_addresses(author, correspondence):
        author_json["emailAddresses"] = author_email_addresses(author, correspondence)

    # phone
    if author_phone_numbers(author, correspondence):
        author_json["phoneNumbers"] = author_phone_numbers_json(author, correspondence)

    # contributions
    if author_contribution(author, contributions):
        author_json["contribution"] = convert(author_contribution(author, contributions))

    # competing interests
    if author_competing_interests(author, competing_interests):
        author_json["competingInterests"] = convert(
            author_competing_interests(author, competing_interests))

    # equal-contributions
    if author_equal_contribution(author, equal_contributions_map):
        author_json["equalContributionGroups"] = author_equal_contribution(author, equal_contributions_map)

    # postalAddress
    if author_present_address(author, present_address_data):
        author_json["postalAddresses"] = author_present_address(author, present_address_data)

    return author_json
1208227
def envelope(self):
		""""""
		if not self.sender and not self.author:
			raise ValueError("Unable to determine message sender; no author or sender defined.")

		return self.sender or self.author[0]
379866
def mention_users
      mentions ||= begin
                     regex = /@([\w]+)/
                     self.body.scan(regex).flatten
                   end
      mentioned_users ||= User.where(username: mentions)

      if mentioned_users.any?
        mentioned_users.each do |i|
          FiatNotifications::Notification::CreateNotificationJob.set(wait: 5.seconds).perform_later(
            self,
            self.authorable,
            i,
            action: "mentioned",
            notified_type: "User",
            notified_ids: [i.id],
            email_template_id: FiatNotifications.email_template_id,
            email_subject: "You were mentioned: '#{self.commentable.subject}' on #{l self.created_at, format: :complete}",
            email_body: "#{self.body}",
            reply_to_address: FiatNotifications.reply_to_email_address
          )
        end
      end
    end
1156454
def authors_json(soup):
    """"""
    authors_json_data = []
    contributors_data = contributors(soup, "full")
    author_contributions_data = author_contributions(soup, None)
    author_competing_interests_data = competing_interests(soup, None)
    author_correspondence_data = full_correspondence(soup)
    authors_non_byline_data = authors_non_byline(soup)
    equal_contributions_map = map_equal_contributions(contributors_data)
    present_address_data = present_addresses(soup)
    foot_notes_data = other_foot_notes(soup)

    # First line authors builds basic structure
    for contributor in contributors_data:
        author_json = None
        if contributor["type"] == "author" and contributor.get("collab"):
            author_json = author_group(contributor, author_contributions_data,
                                       author_correspondence_data, author_competing_interests_data,
                                       equal_contributions_map, present_address_data,
                                       foot_notes_data)
        elif contributor.get("on-behalf-of"):
            author_json = author_on_behalf_of(contributor)
        elif contributor["type"] == "author" and not contributor.get("group-author-key"):
            author_json = author_person(contributor, author_contributions_data,
                                        author_correspondence_data, author_competing_interests_data,
                                        equal_contributions_map, present_address_data, foot_notes_data)

        if author_json:
            authors_json_data.append(author_json)

    # Second, add byline author data
    collab_map = collab_to_group_author_key_map(contributors_data)
    for contributor in [elem for elem in contributors_data if elem.get("group-author-key") and not elem.get("collab")]:
        for group_author in [elem for elem in authors_json_data if elem.get('type') == 'group']:
            group_author_key = None
            if group_author["name"] in collab_map:
                group_author_key = collab_map[group_author["name"]]
            if contributor.get("group-author-key") == group_author_key:
                author_json = author_person(contributor, author_contributions_data,
                                            author_correspondence_data, author_competing_interests_data,
                                            equal_contributions_map, present_address_data, foot_notes_data)
                if contributor.get("sub-group"):
                    if "groups" not in group_author:
                        group_author["groups"] = OrderedDict()
                    if contributor.get("sub-group") not in group_author["groups"]:
                        group_author["groups"][contributor.get("sub-group")] = []
                    group_author["groups"][contributor.get("sub-group")].append(author_json)
                else:
                    if "people" not in group_author:
                        group_author["people"] = []
                    group_author["people"].append(author_json)

    authors_json_data_rewritten = elifetools.json_rewrite.rewrite_json("authors_json", soup, authors_json_data)
    return authors_json_data_rewritten
1012613
def deliver_welcome_mail
      if has_role?('author') || has_role?('editor') || has_role?('admin')
        Notifications.alchemy_user_created(self).deliver_later
      else
        Notifications.member_created(self).deliver_later
      end
    end
652542
def name(self):  # pylint: disable=no-self-use
        
        if 'lis_person_sourcedid' in self.session:
            return self.session['lis_person_sourcedid']
        elif 'lis_person_contact_email_primary' in self.session:
            return self.session['lis_person_contact_email_primary']
        elif 'user_id' in self.session:
            return self.session['user_id']
        else:
            return ''
430015
def mime(self):
		""""""
		author = self.author
		sender = self.sender
		
		if not author:
			raise ValueError("You must specify an author.")

		if not self.subject:
			raise ValueError("You must specify a subject.")

		if len(self.recipients) == 0:
			raise ValueError("You must specify at least one recipient.")

		if not self.plain:
			raise ValueError("You must provide plain text content.")

		# DISCUSS: Take the first author, or raise this error?
		# if len(author) > 1 and len(sender) == 0:
		#	 raise ValueError('If there are multiple authors of message, you must specify a sender!')

		# if len(sender) > 1:
		#	 raise ValueError('You must not specify more than one sender!')

		if not self._dirty and self._processed:
			return self._mime

		self._processed = False

		plain = MIMEText(self._callable(self.plain), 'plain', self.encoding)

		rich = None
		if self.rich:
			rich = MIMEText(self._callable(self.rich), 'html', self.encoding)

		message = self._mime_document(plain, rich)
		headers = self._build_header_list(author, sender)
		self._add_headers_to_message(message, headers)

		self._mime = message
		self._processed = True
		self._dirty = False

		return message
1255655
def process_name(data)
      validate_name(data['name'])
      author, @module_name = data['name'].split(/[-\/]/, 2)

      data['author'] ||= author if @data['author'] == DEFAULTS['author']
    end
1013775
def nameTuple(s: Influence) -> Tuple[str, str]:
    
    return top_grounding(s.subj), top_grounding(s.obj)
1330058
def _author_line(self):
        
        if self.author and self.institution:
            return self.author + ";" + self.institution
        elif self.author:
            return self.author
        else:
            return self.institution
1046923
function author() {
      function _author(auth) {
        var format;
        if (typeof auth === 'string') {
          return auth;
        }
        format = require('util').format;
        return format('%s <%s>', auth.name, auth.email);
      }

      if (Array.isArray(pkg.author)) {
        return pkg.author.map(function makeAuthor(auth) {
          return _author(auth);
        }).join(', ');
      }
      return _author(pkg.author);
    }
1026606
def serializeInstitution(self):
        
        institution_data = []
        institution_instance_data = []
        affiliation_data = []
        affiliation_id = tethnedao.getMaxAffiliationID()
        institution_id = tethnedao.getMaxInstitutionID()
        institution_instance_id = tethnedao.getMaxInstitutionInstanceID()

        for paper in self.corpus:
            if hasattr(paper, 'authorAddress'):
                paper_key = getattr(paper, Serialize.paper_source_map[self.source])
                if type(paper.authorAddress) is unicode:
                    institution_id += 1
                    institution_instance_id += 1
                    institute_literal, authors = SerializeUtility.get_auth_inst(paper.authorAddress)
                    institute_row, institute_instance_row = self.get_details_from_inst_literal(institute_literal,
                                                                                               institution_id,
                                                                                               institution_instance_id,
                                                                                               paper_key)
                    if institute_row:
                        institution_data.append(institute_row)
                    institution_instance_data.append(institute_instance_row)
                    if authors:
                        for author in authors:
                            affiliation_id += 1
                            affiliation_row = self.get_affiliation_details(author, affiliation_id, institute_literal)
                            affiliation_data.append(affiliation_row)

                elif type(paper.authorAddress) is list:
                    for address in paper.authorAddress:
                        institution_id += 1
                        institution_instance_id += 1
                        institute_literal, authors = SerializeUtility.get_auth_inst(address)
                        institute_row, institute_instance_row = self.get_details_from_inst_literal(institute_literal,
                                                                                                   institution_id,
                                                                                                   institution_instance_id,
                                                                                                   paper_key)
                        if institute_row:
                            institution_data.append(institute_row)
                        institution_instance_data.append(institute_instance_row)
                        if authors is None:
                            authors = prevAuthors
                        for author in authors:
                            affiliation_id += 1
                            affiliation_row = self.get_affiliation_details(author, affiliation_id, institute_literal)
                            affiliation_data.append(affiliation_row)
                        prevAuthors = authors
        return institution_data, institution_instance_data, affiliation_data
1313166
def name(self):
        """"""
        try:
            return tuple(
                getattr(self, x) if getattr(self, x) else u''
                for x in ('country', 'state', 'county', 'city'))
        except:
            return tuple(
                getattr(self, x) if getattr(self, x) else ''
                for x in ('country', 'state', 'county', 'city'))