1# -*- coding: utf-8 -*-
2
3############################ Copyrights and license ############################
4#                                                                              #
5# Copyright 2012 Steve English <steve.english@navetas.com>                     #
6# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net>                 #
7# Copyright 2012 Zearin <zearin@gonk.net>                                      #
8# Copyright 2013 AKFish <akfish@gmail.com>                                     #
9# Copyright 2013 Cameron White <cawhite@pdx.edu>                               #
10# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net>                 #
11# Copyright 2013 poulp <mathieu.nerv@gmail.com>                                #
12# Copyright 2014 Tomas Radej <tradej@redhat.com>                               #
13# Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net>                 #
14# Copyright 2016 E. Dunham <github@edunham.net>                                #
15# Copyright 2016 Jannis Gebauer <ja.geb@me.com>                                #
16# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com>          #
17# Copyright 2017 Balázs Rostás <rostas.balazs@gmail.com>                       #
18# Copyright 2017 Jannis Gebauer <ja.geb@me.com>                                #
19# Copyright 2017 Simon <spam@esemi.ru>                                         #
20# Copyright 2018 Wan Liuyang <tsfdye@gmail.com>                                #
21# Copyright 2018 bryanhuntesl <31992054+bryanhuntesl@users.noreply.github.com> #
22# Copyright 2018 sfdye <tsfdye@gmail.com>                                      #
23# Copyright 2018 itsbruce <it.is.bruce@gmail.com>                              #
24# Copyright 2019 Rigas Papathanasopoulos <rigaspapas@gmail.com>                #
25#                                                                              #
26# This file is part of PyGithub.                                               #
27# http://pygithub.readthedocs.io/                                              #
28#                                                                              #
29# PyGithub is free software: you can redistribute it and/or modify it under    #
30# the terms of the GNU Lesser General Public License as published by the Free  #
31# Software Foundation, either version 3 of the License, or (at your option)    #
32# any later version.                                                           #
33#                                                                              #
34# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY  #
35# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS    #
36# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
37# details.                                                                     #
38#                                                                              #
39# You should have received a copy of the GNU Lesser General Public License     #
40# along with PyGithub. If not, see <http://www.gnu.org/licenses/>.             #
41#                                                                              #
42################################################################################
43
44import datetime
45
46import github.Authorization
47import github.Event
48import github.Gist
49import github.GithubObject
50import github.Invitation
51import github.Issue
52import github.Membership
53import github.Migration
54import github.NamedUser
55import github.Notification
56import github.Organization
57import github.PaginatedList
58import github.Plan
59import github.Repository
60import github.UserKey
61
62from . import Consts
63
64
65class AuthenticatedUser(github.GithubObject.CompletableGithubObject):
66    """
67    This class represents AuthenticatedUsers as returned by https://developer.github.com/v3/users/#get-the-authenticated-user
68
69    An AuthenticatedUser object can be created by calling ``get_user()`` on a Github object.
70    """
71
72    def __repr__(self):
73        return self.get__repr__({"login": self._login.value})
74
75    @property
76    def avatar_url(self):
77        """
78        :type: string
79        """
80        self._completeIfNotSet(self._avatar_url)
81        return self._avatar_url.value
82
83    @property
84    def bio(self):
85        """
86        :type: string
87        """
88        self._completeIfNotSet(self._bio)
89        return self._bio.value
90
91    @property
92    def blog(self):
93        """
94        :type: string
95        """
96        self._completeIfNotSet(self._blog)
97        return self._blog.value
98
99    @property
100    def collaborators(self):
101        """
102        :type: integer
103        """
104        self._completeIfNotSet(self._collaborators)
105        return self._collaborators.value
106
107    @property
108    def company(self):
109        """
110        :type: string
111        """
112        self._completeIfNotSet(self._company)
113        return self._company.value
114
115    @property
116    def created_at(self):
117        """
118        :type: datetime.datetime
119        """
120        self._completeIfNotSet(self._created_at)
121        return self._created_at.value
122
123    @property
124    def disk_usage(self):
125        """
126        :type: integer
127        """
128        self._completeIfNotSet(self._disk_usage)
129        return self._disk_usage.value
130
131    @property
132    def email(self):
133        """
134        :type: string
135        """
136        self._completeIfNotSet(self._email)
137        return self._email.value
138
139    @property
140    def events_url(self):
141        """
142        :type: string
143        """
144        self._completeIfNotSet(self._events_url)
145        return self._events_url.value
146
147    @property
148    def followers(self):
149        """
150        :type: integer
151        """
152        self._completeIfNotSet(self._followers)
153        return self._followers.value
154
155    @property
156    def followers_url(self):
157        """
158        :type: string
159        """
160        self._completeIfNotSet(self._followers_url)
161        return self._followers_url.value
162
163    @property
164    def following(self):
165        """
166        :type: integer
167        """
168        self._completeIfNotSet(self._following)
169        return self._following.value
170
171    @property
172    def following_url(self):
173        """
174        :type: string
175        """
176        self._completeIfNotSet(self._following_url)
177        return self._following_url.value
178
179    @property
180    def gists_url(self):
181        """
182        :type: string
183        """
184        self._completeIfNotSet(self._gists_url)
185        return self._gists_url.value
186
187    @property
188    def gravatar_id(self):
189        """
190        :type: string
191        """
192        self._completeIfNotSet(self._gravatar_id)
193        return self._gravatar_id.value
194
195    @property
196    def hireable(self):
197        """
198        :type: bool
199        """
200        self._completeIfNotSet(self._hireable)
201        return self._hireable.value
202
203    @property
204    def html_url(self):
205        """
206        :type: string
207        """
208        self._completeIfNotSet(self._html_url)
209        return self._html_url.value
210
211    @property
212    def id(self):
213        """
214        :type: integer
215        """
216        self._completeIfNotSet(self._id)
217        return self._id.value
218
219    @property
220    def location(self):
221        """
222        :type: string
223        """
224        self._completeIfNotSet(self._location)
225        return self._location.value
226
227    @property
228    def login(self):
229        """
230        :type: string
231        """
232        self._completeIfNotSet(self._login)
233        return self._login.value
234
235    @property
236    def name(self):
237        """
238        :type: string
239        """
240        self._completeIfNotSet(self._name)
241        return self._name.value
242
243    @property
244    def node_id(self):
245        """
246        :type: string
247        """
248        self._completeIfNotSet(self._node_id)
249        return self._node_id.value
250
251    @property
252    def organizations_url(self):
253        """
254        :type: string
255        """
256        self._completeIfNotSet(self._organizations_url)
257        return self._organizations_url.value
258
259    @property
260    def owned_private_repos(self):
261        """
262        :type: integer
263        """
264        self._completeIfNotSet(self._owned_private_repos)
265        return self._owned_private_repos.value
266
267    @property
268    def plan(self):
269        """
270        :type: :class:`github.Plan.Plan`
271        """
272        self._completeIfNotSet(self._plan)
273        return self._plan.value
274
275    @property
276    def private_gists(self):
277        """
278        :type: integer
279        """
280        self._completeIfNotSet(self._private_gists)
281        return self._private_gists.value
282
283    @property
284    def public_gists(self):
285        """
286        :type: integer
287        """
288        self._completeIfNotSet(self._public_gists)
289        return self._public_gists.value
290
291    @property
292    def public_repos(self):
293        """
294        :type: integer
295        """
296        self._completeIfNotSet(self._public_repos)
297        return self._public_repos.value
298
299    @property
300    def received_events_url(self):
301        """
302        :type: string
303        """
304        self._completeIfNotSet(self._received_events_url)
305        return self._received_events_url.value
306
307    @property
308    def repos_url(self):
309        """
310        :type: string
311        """
312        self._completeIfNotSet(self._repos_url)
313        return self._repos_url.value
314
315    @property
316    def site_admin(self):
317        """
318        :type: bool
319        """
320        self._completeIfNotSet(self._site_admin)
321        return self._site_admin.value
322
323    @property
324    def starred_url(self):
325        """
326        :type: string
327        """
328        self._completeIfNotSet(self._starred_url)
329        return self._starred_url.value
330
331    @property
332    def subscriptions_url(self):
333        """
334        :type: string
335        """
336        self._completeIfNotSet(self._subscriptions_url)
337        return self._subscriptions_url.value
338
339    @property
340    def total_private_repos(self):
341        """
342        :type: integer
343        """
344        self._completeIfNotSet(self._total_private_repos)
345        return self._total_private_repos.value
346
347    @property
348    def type(self):
349        """
350        :type: string
351        """
352        self._completeIfNotSet(self._type)
353        return self._type.value
354
355    @property
356    def updated_at(self):
357        """
358        :type: datetime.datetime
359        """
360        self._completeIfNotSet(self._updated_at)
361        return self._updated_at.value
362
363    @property
364    def url(self):
365        """
366        :type: string
367        """
368        self._completeIfNotSet(self._url)
369        return self._url.value
370
371    def add_to_emails(self, *emails):
372        """
373        :calls: `POST /user/emails <http://developer.github.com/v3/users/emails>`_
374        :param email: string
375        :rtype: None
376        """
377        assert all(isinstance(element, str) for element in emails), emails
378        post_parameters = emails
379        headers, data = self._requester.requestJsonAndCheck(
380            "POST", "/user/emails", input=post_parameters
381        )
382
383    def add_to_following(self, following):
384        """
385        :calls: `PUT /user/following/:user <http://developer.github.com/v3/users/followers>`_
386        :param following: :class:`github.NamedUser.NamedUser`
387        :rtype: None
388        """
389        assert isinstance(following, github.NamedUser.NamedUser), following
390        headers, data = self._requester.requestJsonAndCheck(
391            "PUT", "/user/following/" + following._identity
392        )
393
394    def add_to_starred(self, starred):
395        """
396        :calls: `PUT /user/starred/:owner/:repo <http://developer.github.com/v3/activity/starring>`_
397        :param starred: :class:`github.Repository.Repository`
398        :rtype: None
399        """
400        assert isinstance(starred, github.Repository.Repository), starred
401        headers, data = self._requester.requestJsonAndCheck(
402            "PUT", "/user/starred/" + starred._identity
403        )
404
405    def add_to_subscriptions(self, subscription):
406        """
407        :calls: `PUT /user/subscriptions/:owner/:repo <http://developer.github.com/v3/activity/watching>`_
408        :param subscription: :class:`github.Repository.Repository`
409        :rtype: None
410        """
411        assert isinstance(subscription, github.Repository.Repository), subscription
412        headers, data = self._requester.requestJsonAndCheck(
413            "PUT", "/user/subscriptions/" + subscription._identity
414        )
415
416    def add_to_watched(self, watched):
417        """
418        :calls: `PUT /repos/:owner/:repo/subscription <http://developer.github.com/v3/activity/watching>`_
419        :param watched: :class:`github.Repository.Repository`
420        :rtype: None
421        """
422        assert isinstance(watched, github.Repository.Repository), watched
423        headers, data = self._requester.requestJsonAndCheck(
424            "PUT",
425            "/repos/" + watched._identity + "/subscription",
426            input={"subscribed": True},
427        )
428
429    def create_authorization(
430        self,
431        scopes=github.GithubObject.NotSet,
432        note=github.GithubObject.NotSet,
433        note_url=github.GithubObject.NotSet,
434        client_id=github.GithubObject.NotSet,
435        client_secret=github.GithubObject.NotSet,
436        onetime_password=None,
437    ):
438        """
439        :calls: `POST /authorizations <http://developer.github.com/v3/oauth>`_
440        :param scopes: list of string
441        :param note: string
442        :param note_url: string
443        :param client_id: string
444        :param client_secret: string
445        :param onetime_password: string
446        :rtype: :class:`github.Authorization.Authorization`
447        """
448        assert scopes is github.GithubObject.NotSet or all(
449            isinstance(element, str) for element in scopes
450        ), scopes
451        assert note is github.GithubObject.NotSet or isinstance(note, str), note
452        assert note_url is github.GithubObject.NotSet or isinstance(
453            note_url, str
454        ), note_url
455        assert client_id is github.GithubObject.NotSet or isinstance(
456            client_id, str
457        ), client_id
458        assert client_secret is github.GithubObject.NotSet or isinstance(
459            client_secret, str
460        ), client_secret
461        assert onetime_password is None or isinstance(
462            onetime_password, str
463        ), onetime_password
464        post_parameters = dict()
465        if scopes is not github.GithubObject.NotSet:
466            post_parameters["scopes"] = scopes
467        if note is not github.GithubObject.NotSet:
468            post_parameters["note"] = note
469        if note_url is not github.GithubObject.NotSet:
470            post_parameters["note_url"] = note_url
471        if client_id is not github.GithubObject.NotSet:
472            post_parameters["client_id"] = client_id
473        if client_secret is not github.GithubObject.NotSet:
474            post_parameters["client_secret"] = client_secret
475        if onetime_password is not None:
476            request_header = {
477                Consts.headerOTP: onetime_password
478            }  # pragma no cover (Should be covered)
479        else:
480            request_header = None
481        headers, data = self._requester.requestJsonAndCheck(
482            "POST",
483            "/authorizations",
484            input=post_parameters,
485            headers=request_header,
486        )
487        return github.Authorization.Authorization(
488            self._requester, headers, data, completed=True
489        )
490
491    def create_fork(self, repo):
492        """
493        :calls: `POST /repos/:owner/:repo/forks <http://developer.github.com/v3/repos/forks>`_
494        :param repo: :class:`github.Repository.Repository`
495        :rtype: :class:`github.Repository.Repository`
496        """
497        assert isinstance(repo, github.Repository.Repository), repo
498        headers, data = self._requester.requestJsonAndCheck(
499            "POST", "/repos/" + repo.owner.login + "/" + repo.name + "/forks"
500        )
501        return github.Repository.Repository(
502            self._requester, headers, data, completed=True
503        )
504
505    def create_gist(self, public, files, description=github.GithubObject.NotSet):
506        """
507        :calls: `POST /gists <http://developer.github.com/v3/gists>`_
508        :param public: bool
509        :param files: dict of string to :class:`github.InputFileContent.InputFileContent`
510        :param description: string
511        :rtype: :class:`github.Gist.Gist`
512        """
513        assert isinstance(public, bool), public
514        assert all(
515            isinstance(element, github.InputFileContent) for element in files.values()
516        ), files
517        assert description is github.GithubObject.NotSet or isinstance(
518            description, str
519        ), description
520        post_parameters = {
521            "public": public,
522            "files": {key: value._identity for key, value in files.items()},
523        }
524        if description is not github.GithubObject.NotSet:
525            post_parameters["description"] = description
526        headers, data = self._requester.requestJsonAndCheck(
527            "POST", "/gists", input=post_parameters
528        )
529        return github.Gist.Gist(self._requester, headers, data, completed=True)
530
531    def create_key(self, title, key):
532        """
533        :calls: `POST /user/keys <http://developer.github.com/v3/users/keys>`_
534        :param title: string
535        :param key: string
536        :rtype: :class:`github.UserKey.UserKey`
537        """
538        assert isinstance(title, str), title
539        assert isinstance(key, str), key
540        post_parameters = {
541            "title": title,
542            "key": key,
543        }
544        headers, data = self._requester.requestJsonAndCheck(
545            "POST", "/user/keys", input=post_parameters
546        )
547        return github.UserKey.UserKey(self._requester, headers, data, completed=True)
548
549    def create_project(self, name, body=github.GithubObject.NotSet):
550        """
551        :calls: `POST /user/projects <https://developer.github.com/v3/projects/#create-a-user-project>`_
552        :param name: string
553        :param body: string
554        :rtype: :class:`github.Project.Project`
555        """
556        assert isinstance(name, str), name
557        assert body is github.GithubObject.NotSet or isinstance(body, str), body
558        post_parameters = {
559            "name": name,
560            "body": body,
561        }
562        headers, data = self._requester.requestJsonAndCheck(
563            "POST",
564            "/user/projects",
565            input=post_parameters,
566            headers={"Accept": Consts.mediaTypeProjectsPreview},
567        )
568        return github.Project.Project(self._requester, headers, data, completed=True)
569
570    def create_repo(
571        self,
572        name,
573        description=github.GithubObject.NotSet,
574        homepage=github.GithubObject.NotSet,
575        private=github.GithubObject.NotSet,
576        has_issues=github.GithubObject.NotSet,
577        has_wiki=github.GithubObject.NotSet,
578        has_downloads=github.GithubObject.NotSet,
579        has_projects=github.GithubObject.NotSet,
580        auto_init=github.GithubObject.NotSet,
581        license_template=github.GithubObject.NotSet,
582        gitignore_template=github.GithubObject.NotSet,
583        allow_squash_merge=github.GithubObject.NotSet,
584        allow_merge_commit=github.GithubObject.NotSet,
585        allow_rebase_merge=github.GithubObject.NotSet,
586        delete_branch_on_merge=github.GithubObject.NotSet,
587    ):
588        """
589        :calls: `POST /user/repos <http://developer.github.com/v3/repos>`_
590        :param name: string
591        :param description: string
592        :param homepage: string
593        :param private: bool
594        :param has_issues: bool
595        :param has_wiki: bool
596        :param has_downloads: bool
597        :param has_projects: bool
598        :param auto_init: bool
599        :param license_template: string
600        :param gitignore_template: string
601        :param allow_squash_merge: bool
602        :param allow_merge_commit: bool
603        :param allow_rebase_merge: bool
604        :param delete_branch_on_merge: bool
605        :rtype: :class:`github.Repository.Repository`
606        """
607        assert isinstance(name, str), name
608        assert description is github.GithubObject.NotSet or isinstance(
609            description, str
610        ), description
611        assert homepage is github.GithubObject.NotSet or isinstance(
612            homepage, str
613        ), homepage
614        assert private is github.GithubObject.NotSet or isinstance(
615            private, bool
616        ), private
617        assert has_issues is github.GithubObject.NotSet or isinstance(
618            has_issues, bool
619        ), has_issues
620        assert has_wiki is github.GithubObject.NotSet or isinstance(
621            has_wiki, bool
622        ), has_wiki
623        assert has_downloads is github.GithubObject.NotSet or isinstance(
624            has_downloads, bool
625        ), has_downloads
626        assert has_projects is github.GithubObject.NotSet or isinstance(
627            has_projects, bool
628        ), has_projects
629        assert auto_init is github.GithubObject.NotSet or isinstance(
630            auto_init, bool
631        ), auto_init
632        assert license_template is github.GithubObject.NotSet or isinstance(
633            license_template, str
634        ), license_template
635        assert gitignore_template is github.GithubObject.NotSet or isinstance(
636            gitignore_template, str
637        ), gitignore_template
638        assert allow_squash_merge is github.GithubObject.NotSet or isinstance(
639            allow_squash_merge, bool
640        ), allow_squash_merge
641        assert allow_merge_commit is github.GithubObject.NotSet or isinstance(
642            allow_merge_commit, bool
643        ), allow_merge_commit
644        assert allow_rebase_merge is github.GithubObject.NotSet or isinstance(
645            allow_rebase_merge, bool
646        ), allow_rebase_merge
647        assert delete_branch_on_merge is github.GithubObject.NotSet or isinstance(
648            delete_branch_on_merge, bool
649        ), delete_branch_on_merge
650        post_parameters = {
651            "name": name,
652        }
653        if description is not github.GithubObject.NotSet:
654            post_parameters["description"] = description
655        if homepage is not github.GithubObject.NotSet:
656            post_parameters["homepage"] = homepage
657        if private is not github.GithubObject.NotSet:
658            post_parameters["private"] = private
659        if has_issues is not github.GithubObject.NotSet:
660            post_parameters["has_issues"] = has_issues
661        if has_wiki is not github.GithubObject.NotSet:
662            post_parameters["has_wiki"] = has_wiki
663        if has_downloads is not github.GithubObject.NotSet:
664            post_parameters["has_downloads"] = has_downloads
665        if has_projects is not github.GithubObject.NotSet:
666            post_parameters["has_projects"] = has_projects
667        if auto_init is not github.GithubObject.NotSet:
668            post_parameters["auto_init"] = auto_init
669        if license_template is not github.GithubObject.NotSet:
670            post_parameters["license_template"] = license_template
671        if gitignore_template is not github.GithubObject.NotSet:
672            post_parameters["gitignore_template"] = gitignore_template
673        if allow_squash_merge is not github.GithubObject.NotSet:
674            post_parameters["allow_squash_merge"] = allow_squash_merge
675        if allow_merge_commit is not github.GithubObject.NotSet:
676            post_parameters["allow_merge_commit"] = allow_merge_commit
677        if allow_rebase_merge is not github.GithubObject.NotSet:
678            post_parameters["allow_rebase_merge"] = allow_rebase_merge
679        if delete_branch_on_merge is not github.GithubObject.NotSet:
680            post_parameters["delete_branch_on_merge"] = delete_branch_on_merge
681        headers, data = self._requester.requestJsonAndCheck(
682            "POST", "/user/repos", input=post_parameters
683        )
684        return github.Repository.Repository(
685            self._requester, headers, data, completed=True
686        )
687
688    def edit(
689        self,
690        name=github.GithubObject.NotSet,
691        email=github.GithubObject.NotSet,
692        blog=github.GithubObject.NotSet,
693        company=github.GithubObject.NotSet,
694        location=github.GithubObject.NotSet,
695        hireable=github.GithubObject.NotSet,
696        bio=github.GithubObject.NotSet,
697    ):
698        """
699        :calls: `PATCH /user <http://developer.github.com/v3/users>`_
700        :param name: string
701        :param email: string
702        :param blog: string
703        :param company: string
704        :param location: string
705        :param hireable: bool
706        :param bio: string
707        :rtype: None
708        """
709        assert name is github.GithubObject.NotSet or isinstance(name, str), name
710        assert email is github.GithubObject.NotSet or isinstance(email, str), email
711        assert blog is github.GithubObject.NotSet or isinstance(blog, str), blog
712        assert company is github.GithubObject.NotSet or isinstance(
713            company, str
714        ), company
715        assert location is github.GithubObject.NotSet or isinstance(
716            location, str
717        ), location
718        assert hireable is github.GithubObject.NotSet or isinstance(
719            hireable, bool
720        ), hireable
721        assert bio is github.GithubObject.NotSet or isinstance(bio, str), bio
722        post_parameters = dict()
723        if name is not github.GithubObject.NotSet:
724            post_parameters["name"] = name
725        if email is not github.GithubObject.NotSet:
726            post_parameters["email"] = email
727        if blog is not github.GithubObject.NotSet:
728            post_parameters["blog"] = blog
729        if company is not github.GithubObject.NotSet:
730            post_parameters["company"] = company
731        if location is not github.GithubObject.NotSet:
732            post_parameters["location"] = location
733        if hireable is not github.GithubObject.NotSet:
734            post_parameters["hireable"] = hireable
735        if bio is not github.GithubObject.NotSet:
736            post_parameters["bio"] = bio
737        headers, data = self._requester.requestJsonAndCheck(
738            "PATCH", "/user", input=post_parameters
739        )
740        self._useAttributes(data)
741
742    def get_authorization(self, id):
743        """
744        :calls: `GET /authorizations/:id <http://developer.github.com/v3/oauth>`_
745        :param id: integer
746        :rtype: :class:`github.Authorization.Authorization`
747        """
748        assert isinstance(id, int), id
749        headers, data = self._requester.requestJsonAndCheck(
750            "GET", "/authorizations/" + str(id)
751        )
752        return github.Authorization.Authorization(
753            self._requester, headers, data, completed=True
754        )
755
756    def get_authorizations(self):
757        """
758        :calls: `GET /authorizations <http://developer.github.com/v3/oauth>`_
759        :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Authorization.Authorization`
760        """
761        return github.PaginatedList.PaginatedList(
762            github.Authorization.Authorization, self._requester, "/authorizations", None
763        )
764
765    def get_emails(self):
766        """
767        :calls: `GET /user/emails <http://developer.github.com/v3/users/emails>`_
768        :rtype: list of string
769        """
770        headers, data = self._requester.requestJsonAndCheck("GET", "/user/emails")
771        return data
772
773    def get_events(self):
774        """
775        :calls: `GET /events <http://developer.github.com/v3/activity/events>`_
776        :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Event.Event`
777        """
778        return github.PaginatedList.PaginatedList(
779            github.Event.Event, self._requester, "/events", None
780        )
781
782    def get_followers(self):
783        """
784        :calls: `GET /user/followers <http://developer.github.com/v3/users/followers>`_
785        :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.NamedUser.NamedUser`
786        """
787        return github.PaginatedList.PaginatedList(
788            github.NamedUser.NamedUser, self._requester, "/user/followers", None
789        )
790
791    def get_following(self):
792        """
793        :calls: `GET /user/following <http://developer.github.com/v3/users/followers>`_
794        :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.NamedUser.NamedUser`
795        """
796        return github.PaginatedList.PaginatedList(
797            github.NamedUser.NamedUser, self._requester, "/user/following", None
798        )
799
800    def get_gists(self, since=github.GithubObject.NotSet):
801        """
802        :calls: `GET /gists <http://developer.github.com/v3/gists>`_
803        :param since: datetime.datetime format YYYY-MM-DDTHH:MM:SSZ
804        :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Gist.Gist`
805        """
806        assert since is github.GithubObject.NotSet or isinstance(
807            since, datetime.datetime
808        ), since
809        url_parameters = dict()
810        if since is not github.GithubObject.NotSet:
811            url_parameters["since"] = since.strftime("%Y-%m-%dT%H:%M:%SZ")
812        return github.PaginatedList.PaginatedList(
813            github.Gist.Gist, self._requester, "/gists", url_parameters
814        )
815
816    def get_issues(
817        self,
818        filter=github.GithubObject.NotSet,
819        state=github.GithubObject.NotSet,
820        labels=github.GithubObject.NotSet,
821        sort=github.GithubObject.NotSet,
822        direction=github.GithubObject.NotSet,
823        since=github.GithubObject.NotSet,
824    ):
825        """
826        :calls: `GET /issues <http://developer.github.com/v3/issues>`_
827        :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Issue.Issue`
828        :param filter: string
829        :param state: string
830        :param labels: list of :class:`github.Label.Label`
831        :param sort: string
832        :param direction: string
833        :param since: datetime.datetime
834        :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Issue.Issue`
835        """
836        assert filter is github.GithubObject.NotSet or isinstance(filter, str), filter
837        assert state is github.GithubObject.NotSet or isinstance(state, str), state
838        assert labels is github.GithubObject.NotSet or all(
839            isinstance(element, github.Label.Label) for element in labels
840        ), labels
841        assert sort is github.GithubObject.NotSet or isinstance(sort, str), sort
842        assert direction is github.GithubObject.NotSet or isinstance(
843            direction, str
844        ), direction
845        assert since is github.GithubObject.NotSet or isinstance(
846            since, datetime.datetime
847        ), since
848        url_parameters = dict()
849        if filter is not github.GithubObject.NotSet:
850            url_parameters["filter"] = filter
851        if state is not github.GithubObject.NotSet:
852            url_parameters["state"] = state
853        if labels is not github.GithubObject.NotSet:
854            url_parameters["labels"] = ",".join(label.name for label in labels)
855        if sort is not github.GithubObject.NotSet:
856            url_parameters["sort"] = sort
857        if direction is not github.GithubObject.NotSet:
858            url_parameters["direction"] = direction
859        if since is not github.GithubObject.NotSet:
860            url_parameters["since"] = since.strftime("%Y-%m-%dT%H:%M:%SZ")
861        return github.PaginatedList.PaginatedList(
862            github.Issue.Issue, self._requester, "/issues", url_parameters
863        )
864
865    def get_user_issues(
866        self,
867        filter=github.GithubObject.NotSet,
868        state=github.GithubObject.NotSet,
869        labels=github.GithubObject.NotSet,
870        sort=github.GithubObject.NotSet,
871        direction=github.GithubObject.NotSet,
872        since=github.GithubObject.NotSet,
873    ):
874        """
875        :calls: `GET /user/issues <http://developer.github.com/v3/issues>`_
876        :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Issue.Issue`
877        :param filter: string
878        :param state: string
879        :param labels: list of :class:`github.Label.Label`
880        :param sort: string
881        :param direction: string
882        :param since: datetime.datetime
883        :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Issue.Issue`
884        """
885        assert filter is github.GithubObject.NotSet or isinstance(filter, str), filter
886        assert state is github.GithubObject.NotSet or isinstance(state, str), state
887        assert labels is github.GithubObject.NotSet or all(
888            isinstance(element, github.Label.Label) for element in labels
889        ), labels
890        assert sort is github.GithubObject.NotSet or isinstance(sort, str), sort
891        assert direction is github.GithubObject.NotSet or isinstance(
892            direction, str
893        ), direction
894        assert since is github.GithubObject.NotSet or isinstance(
895            since, datetime.datetime
896        ), since
897        url_parameters = dict()
898        if filter is not github.GithubObject.NotSet:
899            url_parameters["filter"] = filter
900        if state is not github.GithubObject.NotSet:
901            url_parameters["state"] = state
902        if labels is not github.GithubObject.NotSet:
903            url_parameters["labels"] = ",".join(label.name for label in labels)
904        if sort is not github.GithubObject.NotSet:
905            url_parameters["sort"] = sort
906        if direction is not github.GithubObject.NotSet:
907            url_parameters["direction"] = direction
908        if since is not github.GithubObject.NotSet:
909            url_parameters["since"] = since.strftime("%Y-%m-%dT%H:%M:%SZ")
910        return github.PaginatedList.PaginatedList(
911            github.Issue.Issue, self._requester, "/issues", url_parameters
912        )
913
914    def get_key(self, id):
915        """
916        :calls: `GET /user/keys/:id <http://developer.github.com/v3/users/keys>`_
917        :param id: integer
918        :rtype: :class:`github.UserKey.UserKey`
919        """
920        assert isinstance(id, int), id
921        headers, data = self._requester.requestJsonAndCheck(
922            "GET", "/user/keys/" + str(id)
923        )
924        return github.UserKey.UserKey(self._requester, headers, data, completed=True)
925
926    def get_keys(self):
927        """
928        :calls: `GET /user/keys <http://developer.github.com/v3/users/keys>`_
929        :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.UserKey.UserKey`
930        """
931        return github.PaginatedList.PaginatedList(
932            github.UserKey.UserKey, self._requester, "/user/keys", None
933        )
934
935    def get_notification(self, id):
936        """
937        :calls: `GET /notifications/threads/:id <http://developer.github.com/v3/activity/notifications>`_
938        :rtype: :class:`github.Notification.Notification`
939        """
940
941        assert isinstance(id, str), id
942        headers, data = self._requester.requestJsonAndCheck(
943            "GET", "/notifications/threads/" + id
944        )
945        return github.Notification.Notification(
946            self._requester, headers, data, completed=True
947        )
948
949    def get_notifications(
950        self,
951        all=github.GithubObject.NotSet,
952        participating=github.GithubObject.NotSet,
953        since=github.GithubObject.NotSet,
954        before=github.GithubObject.NotSet,
955    ):
956        """
957        :calls: `GET /notifications <http://developer.github.com/v3/activity/notifications>`_
958        :param all: bool
959        :param participating: bool
960        :param since: datetime.datetime
961        :param before: datetime.datetime
962        :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Notification.Notification`
963        """
964
965        assert all is github.GithubObject.NotSet or isinstance(all, bool), all
966        assert participating is github.GithubObject.NotSet or isinstance(
967            participating, bool
968        ), participating
969        assert since is github.GithubObject.NotSet or isinstance(
970            since, datetime.datetime
971        ), since
972        assert before is github.GithubObject.NotSet or isinstance(
973            before, datetime.datetime
974        ), before
975
976        params = dict()
977        if all is not github.GithubObject.NotSet:
978            params["all"] = all
979        if participating is not github.GithubObject.NotSet:
980            params["participating"] = participating
981        if since is not github.GithubObject.NotSet:
982            params["since"] = since.strftime("%Y-%m-%dT%H:%M:%SZ")
983        if before is not github.GithubObject.NotSet:
984            params["before"] = before.strftime("%Y-%m-%dT%H:%M:%SZ")
985
986        return github.PaginatedList.PaginatedList(
987            github.Notification.Notification, self._requester, "/notifications", params
988        )
989
990    def get_organization_events(self, org):
991        """
992        :calls: `GET /users/:user/events/orgs/:org <http://developer.github.com/v3/activity/events>`_
993        :param org: :class:`github.Organization.Organization`
994        :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Event.Event`
995        """
996        assert isinstance(org, github.Organization.Organization), org
997        return github.PaginatedList.PaginatedList(
998            github.Event.Event,
999            self._requester,
1000            "/users/" + self.login + "/events/orgs/" + org.login,
1001            None,
1002        )
1003
1004    def get_orgs(self):
1005        """
1006        :calls: `GET /user/orgs <http://developer.github.com/v3/orgs>`_
1007        :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Organization.Organization`
1008        """
1009        return github.PaginatedList.PaginatedList(
1010            github.Organization.Organization, self._requester, "/user/orgs", None
1011        )
1012
1013    def get_repo(self, name):
1014        """
1015        :calls: `GET /repos/:owner/:repo <http://developer.github.com/v3/repos>`_
1016        :param name: string
1017        :rtype: :class:`github.Repository.Repository`
1018        """
1019        assert isinstance(name, str), name
1020        headers, data = self._requester.requestJsonAndCheck(
1021            "GET", "/repos/" + self.login + "/" + name
1022        )
1023        return github.Repository.Repository(
1024            self._requester, headers, data, completed=True
1025        )
1026
1027    def get_repos(
1028        self,
1029        visibility=github.GithubObject.NotSet,
1030        affiliation=github.GithubObject.NotSet,
1031        type=github.GithubObject.NotSet,
1032        sort=github.GithubObject.NotSet,
1033        direction=github.GithubObject.NotSet,
1034    ):
1035        """
1036        :calls: `GET /user/repos <http://developer.github.com/v3/repos>`
1037        :param visibility: string
1038        :param affiliation: string
1039        :param type: string
1040        :param sort: string
1041        :param direction: string
1042        :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Repository.Repository`
1043        """
1044        assert visibility is github.GithubObject.NotSet or isinstance(
1045            visibility, str
1046        ), visibility
1047        assert affiliation is github.GithubObject.NotSet or isinstance(
1048            affiliation, str
1049        ), affiliation
1050        assert type is github.GithubObject.NotSet or isinstance(type, str), type
1051        assert sort is github.GithubObject.NotSet or isinstance(sort, str), sort
1052        assert direction is github.GithubObject.NotSet or isinstance(
1053            direction, str
1054        ), direction
1055        url_parameters = dict()
1056        if visibility is not github.GithubObject.NotSet:
1057            url_parameters["visibility"] = visibility
1058        if affiliation is not github.GithubObject.NotSet:
1059            url_parameters["affiliation"] = affiliation
1060        if type is not github.GithubObject.NotSet:
1061            url_parameters["type"] = type
1062        if sort is not github.GithubObject.NotSet:
1063            url_parameters["sort"] = sort
1064        if direction is not github.GithubObject.NotSet:
1065            url_parameters["direction"] = direction
1066        return github.PaginatedList.PaginatedList(
1067            github.Repository.Repository, self._requester, "/user/repos", url_parameters
1068        )
1069
1070    def get_starred(self):
1071        """
1072        :calls: `GET /user/starred <http://developer.github.com/v3/activity/starring>`_
1073        :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Repository.Repository`
1074        """
1075        return github.PaginatedList.PaginatedList(
1076            github.Repository.Repository, self._requester, "/user/starred", None
1077        )
1078
1079    def get_starred_gists(self):
1080        """
1081        :calls: `GET /gists/starred <http://developer.github.com/v3/gists>`_
1082        :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Gist.Gist`
1083        """
1084        return github.PaginatedList.PaginatedList(
1085            github.Gist.Gist, self._requester, "/gists/starred", None
1086        )
1087
1088    def get_subscriptions(self):
1089        """
1090        :calls: `GET /user/subscriptions <http://developer.github.com/v3/activity/watching>`_
1091        :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Repository.Repository`
1092        """
1093        return github.PaginatedList.PaginatedList(
1094            github.Repository.Repository, self._requester, "/user/subscriptions", None
1095        )
1096
1097    def get_teams(self):
1098        """
1099        :calls: `GET /user/teams <http://developer.github.com/v3/orgs/teams>`_
1100        :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Team.Team`
1101        """
1102        return github.PaginatedList.PaginatedList(
1103            github.Team.Team, self._requester, "/user/teams", None
1104        )
1105
1106    def get_watched(self):
1107        """
1108        :calls: `GET /user/subscriptions <http://developer.github.com/v3/activity/watching>`_
1109        :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Repository.Repository`
1110        """
1111        return github.PaginatedList.PaginatedList(
1112            github.Repository.Repository, self._requester, "/user/subscriptions", None
1113        )
1114
1115    def get_installations(self):
1116        """
1117        :calls: `GET /user/installations <http://developer.github.com/v3/apps>`_
1118        :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Installation.Installation`
1119        """
1120        return github.PaginatedList.PaginatedList(
1121            github.Installation.Installation,
1122            self._requester,
1123            "/user/installations",
1124            None,
1125            headers={"Accept": Consts.mediaTypeIntegrationPreview},
1126            list_item="installations",
1127        )
1128
1129    def has_in_following(self, following):
1130        """
1131        :calls: `GET /user/following/:user <http://developer.github.com/v3/users/followers>`_
1132        :param following: :class:`github.NamedUser.NamedUser`
1133        :rtype: bool
1134        """
1135        assert isinstance(following, github.NamedUser.NamedUser), following
1136        status, headers, data = self._requester.requestJson(
1137            "GET", "/user/following/" + following._identity
1138        )
1139        return status == 204
1140
1141    def has_in_starred(self, starred):
1142        """
1143        :calls: `GET /user/starred/:owner/:repo <http://developer.github.com/v3/activity/starring>`_
1144        :param starred: :class:`github.Repository.Repository`
1145        :rtype: bool
1146        """
1147        assert isinstance(starred, github.Repository.Repository), starred
1148        status, headers, data = self._requester.requestJson(
1149            "GET", "/user/starred/" + starred._identity
1150        )
1151        return status == 204
1152
1153    def has_in_subscriptions(self, subscription):
1154        """
1155        :calls: `GET /user/subscriptions/:owner/:repo <http://developer.github.com/v3/activity/watching>`_
1156        :param subscription: :class:`github.Repository.Repository`
1157        :rtype: bool
1158        """
1159        assert isinstance(subscription, github.Repository.Repository), subscription
1160        status, headers, data = self._requester.requestJson(
1161            "GET", "/user/subscriptions/" + subscription._identity
1162        )
1163        return status == 204
1164
1165    def has_in_watched(self, watched):
1166        """
1167        :calls: `GET /repos/:owner/:repo/subscription <http://developer.github.com/v3/activity/watching>`_
1168        :param watched: :class:`github.Repository.Repository`
1169        :rtype: bool
1170        """
1171        assert isinstance(watched, github.Repository.Repository), watched
1172        status, headers, data = self._requester.requestJson(
1173            "GET", "/repos/" + watched._identity + "/subscription"
1174        )
1175        return status == 200
1176
1177    def mark_notifications_as_read(self, last_read_at=datetime.datetime.utcnow()):
1178        """
1179        :calls: `PUT /notifications <https://developer.github.com/v3/activity/notifications>`_
1180        :param last_read_at: datetime
1181        """
1182        assert isinstance(last_read_at, datetime.datetime)
1183        put_parameters = {"last_read_at": last_read_at.strftime("%Y-%m-%dT%H:%M:%SZ")}
1184
1185        headers, data = self._requester.requestJsonAndCheck(
1186            "PUT", "/notifications", input=put_parameters
1187        )
1188
1189    def remove_from_emails(self, *emails):
1190        """
1191        :calls: `DELETE /user/emails <http://developer.github.com/v3/users/emails>`_
1192        :param email: string
1193        :rtype: None
1194        """
1195        assert all(isinstance(element, str) for element in emails), emails
1196        post_parameters = emails
1197        headers, data = self._requester.requestJsonAndCheck(
1198            "DELETE", "/user/emails", input=post_parameters
1199        )
1200
1201    def remove_from_following(self, following):
1202        """
1203        :calls: `DELETE /user/following/:user <http://developer.github.com/v3/users/followers>`_
1204        :param following: :class:`github.NamedUser.NamedUser`
1205        :rtype: None
1206        """
1207        assert isinstance(following, github.NamedUser.NamedUser), following
1208        headers, data = self._requester.requestJsonAndCheck(
1209            "DELETE", "/user/following/" + following._identity
1210        )
1211
1212    def remove_from_starred(self, starred):
1213        """
1214        :calls: `DELETE /user/starred/:owner/:repo <http://developer.github.com/v3/activity/starring>`_
1215        :param starred: :class:`github.Repository.Repository`
1216        :rtype: None
1217        """
1218        assert isinstance(starred, github.Repository.Repository), starred
1219        headers, data = self._requester.requestJsonAndCheck(
1220            "DELETE", "/user/starred/" + starred._identity
1221        )
1222
1223    def remove_from_subscriptions(self, subscription):
1224        """
1225        :calls: `DELETE /user/subscriptions/:owner/:repo <http://developer.github.com/v3/activity/watching>`_
1226        :param subscription: :class:`github.Repository.Repository`
1227        :rtype: None
1228        """
1229        assert isinstance(subscription, github.Repository.Repository), subscription
1230        headers, data = self._requester.requestJsonAndCheck(
1231            "DELETE", "/user/subscriptions/" + subscription._identity
1232        )
1233
1234    def remove_from_watched(self, watched):
1235        """
1236        :calls: `DELETE /repos/:owner/:repo/subscription <http://developer.github.com/v3/activity/watching>`_
1237        :param watched: :class:`github.Repository.Repository`
1238        :rtype: None
1239        """
1240        assert isinstance(watched, github.Repository.Repository), watched
1241        headers, data = self._requester.requestJsonAndCheck(
1242            "DELETE", "/repos/" + watched._identity + "/subscription"
1243        )
1244
1245    def accept_invitation(self, invitation):
1246        """
1247        :calls: `PATCH /user/repository_invitations/:invitation_id <https://developer.github.com/v3/repos/invitations/>`
1248        :param invitation: :class:`github.Invitation.Invitation` or int
1249        :rtype: None
1250        """
1251        assert isinstance(invitation, github.Invitation.Invitation) or isinstance(
1252            invitation, int
1253        )
1254
1255        if isinstance(invitation, github.Invitation.Invitation):
1256            invitation = invitation.id
1257
1258        headers, data = self._requester.requestJsonAndCheck(
1259            "PATCH", "/user/repository_invitations/" + str(invitation), input={}
1260        )
1261
1262    def get_invitations(self):
1263        """
1264        :calls: `GET /user/repository_invitations <https://developer.github.com/v3/repos/invitations/>`_
1265        :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Invitation.Invitation`
1266        """
1267        return github.PaginatedList.PaginatedList(
1268            github.Invitation.Invitation,
1269            self._requester,
1270            "/user/repository_invitations",
1271            None,
1272        )
1273
1274    def create_migration(
1275        self,
1276        repos,
1277        lock_repositories=github.GithubObject.NotSet,
1278        exclude_attachments=github.GithubObject.NotSet,
1279    ):
1280        """
1281        :calls: `POST /user/migrations <https://developer.github.com/v3/migrations/users>`_
1282        :param repos: list or tuple of str
1283        :param lock_repositories: bool
1284        :param exclude_attachments: bool
1285        :rtype: :class:`github.Migration.Migration`
1286        """
1287        assert isinstance(repos, (list, tuple)), repos
1288        assert all(isinstance(repo, str) for repo in repos), repos
1289        assert lock_repositories is github.GithubObject.NotSet or isinstance(
1290            lock_repositories, bool
1291        ), lock_repositories
1292        assert exclude_attachments is github.GithubObject.NotSet or isinstance(
1293            exclude_attachments, bool
1294        ), exclude_attachments
1295        post_parameters = {"repositories": repos}
1296        if lock_repositories is not github.GithubObject.NotSet:
1297            post_parameters["lock_repositories"] = lock_repositories
1298        if exclude_attachments is not github.GithubObject.NotSet:
1299            post_parameters["exclude_attachments"] = exclude_attachments
1300        headers, data = self._requester.requestJsonAndCheck(
1301            "POST",
1302            "/user/migrations",
1303            input=post_parameters,
1304            headers={"Accept": Consts.mediaTypeMigrationPreview},
1305        )
1306        return github.Migration.Migration(
1307            self._requester, headers, data, completed=True
1308        )
1309
1310    def get_migrations(self):
1311        """
1312        :calls: `GET /user/migrations <https://developer.github.com/v3/migrations/users>`_
1313        :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Migration.Migration`
1314        """
1315        return github.PaginatedList.PaginatedList(
1316            github.Migration.Migration,
1317            self._requester,
1318            "/user/migrations",
1319            None,
1320            headers={"Accept": Consts.mediaTypeMigrationPreview},
1321        )
1322
1323    def get_organization_membership(self, org):
1324        """
1325        :calls: `GET /user/memberships/orgs/:org <https://developer.github.com/v3/orgs/members/#get-your-organization-membership>`_
1326        :rtype: :class:`github.Membership.Membership`
1327        """
1328        assert isinstance(org, str)
1329        headers, data = self._requester.requestJsonAndCheck(
1330            "GET", "/user/memberships/orgs/" + org
1331        )
1332        return github.Membership.Membership(
1333            self._requester, headers, data, completed=True
1334        )
1335
1336    def _initAttributes(self):
1337        self._avatar_url = github.GithubObject.NotSet
1338        self._bio = github.GithubObject.NotSet
1339        self._blog = github.GithubObject.NotSet
1340        self._collaborators = github.GithubObject.NotSet
1341        self._company = github.GithubObject.NotSet
1342        self._created_at = github.GithubObject.NotSet
1343        self._disk_usage = github.GithubObject.NotSet
1344        self._email = github.GithubObject.NotSet
1345        self._events_url = github.GithubObject.NotSet
1346        self._followers = github.GithubObject.NotSet
1347        self._followers_url = github.GithubObject.NotSet
1348        self._following = github.GithubObject.NotSet
1349        self._following_url = github.GithubObject.NotSet
1350        self._gists_url = github.GithubObject.NotSet
1351        self._gravatar_id = github.GithubObject.NotSet
1352        self._hireable = github.GithubObject.NotSet
1353        self._html_url = github.GithubObject.NotSet
1354        self._id = github.GithubObject.NotSet
1355        self._location = github.GithubObject.NotSet
1356        self._login = github.GithubObject.NotSet
1357        self._name = github.GithubObject.NotSet
1358        self._node_id = github.GithubObject.NotSet
1359        self._organizations_url = github.GithubObject.NotSet
1360        self._owned_private_repos = github.GithubObject.NotSet
1361        self._plan = github.GithubObject.NotSet
1362        self._private_gists = github.GithubObject.NotSet
1363        self._public_gists = github.GithubObject.NotSet
1364        self._public_repos = github.GithubObject.NotSet
1365        self._received_events_url = github.GithubObject.NotSet
1366        self._repos_url = github.GithubObject.NotSet
1367        self._site_admin = github.GithubObject.NotSet
1368        self._starred_url = github.GithubObject.NotSet
1369        self._subscriptions_url = github.GithubObject.NotSet
1370        self._total_private_repos = github.GithubObject.NotSet
1371        self._type = github.GithubObject.NotSet
1372        self._updated_at = github.GithubObject.NotSet
1373        self._url = github.GithubObject.NotSet
1374
1375    def _useAttributes(self, attributes):
1376        if "avatar_url" in attributes:  # pragma no branch
1377            self._avatar_url = self._makeStringAttribute(attributes["avatar_url"])
1378        if "bio" in attributes:  # pragma no branch
1379            self._bio = self._makeStringAttribute(attributes["bio"])
1380        if "blog" in attributes:  # pragma no branch
1381            self._blog = self._makeStringAttribute(attributes["blog"])
1382        if "collaborators" in attributes:  # pragma no branch
1383            self._collaborators = self._makeIntAttribute(attributes["collaborators"])
1384        if "company" in attributes:  # pragma no branch
1385            self._company = self._makeStringAttribute(attributes["company"])
1386        if "created_at" in attributes:  # pragma no branch
1387            self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
1388        if "disk_usage" in attributes:  # pragma no branch
1389            self._disk_usage = self._makeIntAttribute(attributes["disk_usage"])
1390        if "email" in attributes:  # pragma no branch
1391            self._email = self._makeStringAttribute(attributes["email"])
1392        if "events_url" in attributes:  # pragma no branch
1393            self._events_url = self._makeStringAttribute(attributes["events_url"])
1394        if "followers" in attributes:  # pragma no branch
1395            self._followers = self._makeIntAttribute(attributes["followers"])
1396        if "followers_url" in attributes:  # pragma no branch
1397            self._followers_url = self._makeStringAttribute(attributes["followers_url"])
1398        if "following" in attributes:  # pragma no branch
1399            self._following = self._makeIntAttribute(attributes["following"])
1400        if "following_url" in attributes:  # pragma no branch
1401            self._following_url = self._makeStringAttribute(attributes["following_url"])
1402        if "gists_url" in attributes:  # pragma no branch
1403            self._gists_url = self._makeStringAttribute(attributes["gists_url"])
1404        if "gravatar_id" in attributes:  # pragma no branch
1405            self._gravatar_id = self._makeStringAttribute(attributes["gravatar_id"])
1406        if "hireable" in attributes:  # pragma no branch
1407            self._hireable = self._makeBoolAttribute(attributes["hireable"])
1408        if "html_url" in attributes:  # pragma no branch
1409            self._html_url = self._makeStringAttribute(attributes["html_url"])
1410        if "id" in attributes:  # pragma no branch
1411            self._id = self._makeIntAttribute(attributes["id"])
1412        if "location" in attributes:  # pragma no branch
1413            self._location = self._makeStringAttribute(attributes["location"])
1414        if "login" in attributes:  # pragma no branch
1415            self._login = self._makeStringAttribute(attributes["login"])
1416        if "name" in attributes:  # pragma no branch
1417            self._name = self._makeStringAttribute(attributes["name"])
1418        if "node_id" in attributes:  # pragma no branch
1419            self._node_id = self._makeStringAttribute(attributes["node_id"])
1420        if "organizations_url" in attributes:  # pragma no branch
1421            self._organizations_url = self._makeStringAttribute(
1422                attributes["organizations_url"]
1423            )
1424        if "owned_private_repos" in attributes:  # pragma no branch
1425            self._owned_private_repos = self._makeIntAttribute(
1426                attributes["owned_private_repos"]
1427            )
1428        if "plan" in attributes:  # pragma no branch
1429            self._plan = self._makeClassAttribute(github.Plan.Plan, attributes["plan"])
1430        if "private_gists" in attributes:  # pragma no branch
1431            self._private_gists = self._makeIntAttribute(attributes["private_gists"])
1432        if "public_gists" in attributes:  # pragma no branch
1433            self._public_gists = self._makeIntAttribute(attributes["public_gists"])
1434        if "public_repos" in attributes:  # pragma no branch
1435            self._public_repos = self._makeIntAttribute(attributes["public_repos"])
1436        if "received_events_url" in attributes:  # pragma no branch
1437            self._received_events_url = self._makeStringAttribute(
1438                attributes["received_events_url"]
1439            )
1440        if "repos_url" in attributes:  # pragma no branch
1441            self._repos_url = self._makeStringAttribute(attributes["repos_url"])
1442        if "site_admin" in attributes:  # pragma no branch
1443            self._site_admin = self._makeBoolAttribute(attributes["site_admin"])
1444        if "starred_url" in attributes:  # pragma no branch
1445            self._starred_url = self._makeStringAttribute(attributes["starred_url"])
1446        if "subscriptions_url" in attributes:  # pragma no branch
1447            self._subscriptions_url = self._makeStringAttribute(
1448                attributes["subscriptions_url"]
1449            )
1450        if "total_private_repos" in attributes:  # pragma no branch
1451            self._total_private_repos = self._makeIntAttribute(
1452                attributes["total_private_repos"]
1453            )
1454        if "type" in attributes:  # pragma no branch
1455            self._type = self._makeStringAttribute(attributes["type"])
1456        if "updated_at" in attributes:  # pragma no branch
1457            self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
1458        if "url" in attributes:  # pragma no branch
1459            self._url = self._makeStringAttribute(attributes["url"])
1460