获取话题关注者

        :return: 话题关注者，返回生成器
        :rtype: Author.Iterable
483086
def followers(self):
        
        from .author import Author, ANONYMOUS
        self._make_soup()
        gotten_data_num = 20
        data = {
            '_xsrf': self.xsrf,
            'start': '',
            'offset': 0
        }
        while gotten_data_num == 20:
            res = self._session.post(
                Topic_Get_More_Follower_Url.format(self.id), data=data)
            j = res.json()['msg']
            gotten_data_num = j[0]
            data['offset'] += gotten_data_num
            soup = BeautifulSoup(j[1])
            divs = soup.find_all('div', class_='zm-person-item')
            for div in divs:
                h2 = div.h2
                url = Zhihu_URL + h2.a['href']
                name = h2.a.text
                motto = h2.parent.div.text.strip()
                try:
                    yield Author(url, name, motto, session=self._session)
                except ValueError:  # invalid url
                    yield ANONYMOUS
            data['start'] = int(re_get_number.match(divs[-1]['id']).group(1))
887961
def to_dict(self):
        ''''''
        if not self.record_type == 'journal':
            # todo: it may be worthwhile creating subclasses for each entry type (journal, conference, etc.) with a common
            # API e.g. to_json which creates output appropriately
            raise Exception('This function has only been tested on journal entries at present.')

        author_list = []
        authors = self.article.get('authors', [])
        for x in range(len(authors)):
            author = authors[x]
            first_name = None
            middle_names = None
            if author.get('given_name'):
                names = author['given_name'].split()
                first_name = names[0]
                middle_names = (' '.join(names[1:])) or None
            author_list.append(
                dict(
                    AuthorOrder = x + 1,
                    FirstName = first_name,
                    MiddleNames = middle_names,
                    Surname = author.get('surname')
                )
            )

        return dict(
            Title = self.article.get('title'),
            PublicationName = self.issue.get('full_title'),
            Volume = self.issue.get('volume'),
            Issue = self.issue.get('issue'),
            StartPage = self.article.get('first_page'),
            EndPage = self.article.get('last_page'),
            PublicationYear = self.get_year(),
            PublicationDate = self.get_earliest_date(),
            RIS = None,
            DOI = self.doi,
            PubMedID = self.get_pubmed_id(),
            URL = 'http://dx.doi.org/%s' % self.doi,
            ISSN = None, # eight-digit number
            authors = author_list,
            #
            RecordType = DOI.record_types.get(self.record_type)
        )
343805
def author(cls, config_reader=None):
        """"""
        return cls._main_actor(cls.env_author_name, cls.env_author_email, config_reader)
1194249
def as_dict(self):
        
        data = get_dict_for_attrs(self, ['id', 'raw_id', 'short_id',
            'revision', 'date', 'message'])
        data['author'] = {'name': self.author_name, 'email': self.author_email}
        data['added'] = [node.path for node in self.added]
        data['changed'] = [node.path for node in self.changed]
        data['removed'] = [node.path for node in self.removed]
        return data
352862
def get_author(self, **kwargs):
        """"""
        qualifier = kwargs.get('qualifier', '')
        children = kwargs.get('children', [])
        creator_type_per = False
        author_name = None
        # Find the creator type in children.
        for child in children:
            if child.tag == 'type' and child.content == 'per':
                creator_type_per = True
            # Get the author name.
            elif child.tag == 'name':
                author_name = child.content
        if qualifier == 'aut' and creator_type_per and author_name:
            return author_name

        return None
828749
def retrieve_author(id=None, username=None):
    

    if id is None and username is None:
        raise SpigotAuthorException("Unable to retrieve an Author without an Identifier")

    if id is None:
        return SpigotAuthor.from_username(username)
    else:
        return SpigotAuthor.from_id(id)
158431
def get_dict(self):
        
        return {
            'authors': self.authors,
            'date_download': self.date_download,
            'date_modify': self.date_modify,
            'date_publish': self.date_publish,
            'description': self.description,
            'filename': self.filename,
            'image_url': self.image_url,
            'language': self.language,
            'localpath': self.localpath,
            'source_domain': self.source_domain,
            'text': self.text,
            'title': self.title,
            'title_page': self.title_page,
            'title_rss': self.title_rss,
            'url': self.url
        }
1033646
def get_epithet_index():
    
    _dict = {}
    for k, v in AUTHOR_EPITHET.items():
        _dict[k] = set(v)
    return _dict
631406
def serializeAuthors(self):
        
        author_details = []
        auid = tethnedao.getMaxAuthorID()
        for val in self.corpus.features['authors'].index.values():
            auid = auid + 1
            self.authorIdMap[val[1]+val[0]] = auid
            instanceData = {
                    "model": "django-tethne.author",
                    "pk": auid,
                    "fields":{
                        "first_name": val[1],
                        "last_name": val[0],
                    }
                }
            author_details.append(instanceData)
        return author_details
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
1338195
def authors(self, *usernames):
        
        if len(usernames) == 1:
            return self.filter(**{"author__{}".format(User.USERNAME_FIELD): usernames[0]})
        else:
            return self.filter(**{"author__{}__in".format(User.USERNAME_FIELD): usernames})
607646
def get_authors(self):
        
        Person = self._session.get_class(surf.ns.EFRBROO['F10_Person'])
        return list(Person.all())
1190110
def author_notes(soup):
    
    author_notes = []

    author_notes_section = raw_parser.author_notes(soup)
    if author_notes_section:
        fn_nodes = raw_parser.fn(author_notes_section)
        for tag in fn_nodes:
            if 'fn-type' in tag.attrs:
                if(tag['fn-type'] != 'present-address'):
                    author_notes.append(node_text(tag))

    return author_notes
583356
def get_authors(apikey, username, password):
    
    authenticate(username, password)
    return [author_structure(author)
            for author in Author.objects.filter(is_staff=True)]
783317
public function author()
    {
        foreach($this->data as $post)
        {
            $id = $post->author;

            $author = get_userdata($id);
            $avatar = get_field('author_avatar', 'user_' . $id);
            $banner = get_field('author_banner', 'user_' . $id);

            $author = (object) [
                'name' => $author->display_name,
                'permalink' => get_author_posts_url($id),
                'images' => (object) [
                    'avatar' => $avatar ? $avatar['url'] : false,
                    'banner' => $banner ? $banner['url'] : false
                ]
            ];

            $post->author = $author;
        }

        return $this;
    }
524362
def compile_authors(authors):
    
    author_list = []
    for person in authors:
        author_list.append({'name': person['family'] + ", " + person['given']})
    return author_list
553278
def top_authors(self):
        
        from .author import Author, ANONYMOUS
        self._make_soup()
        t = self.soup.find('div', id='zh-topic-top-answerer')
        if t is None:
            return
        for d in t.find_all('div', class_='zm-topic-side-person-item-content'):
            url = Zhihu_URL + d.a['href']
            name = d.a.text
            motto = d.find('span', class_='bio')['title']
            try:
                yield Author(url, name, motto, session=self._session)
            except ValueError:  # invalid url
                yield ANONYMOUS