comparison venv/lib/python2.7/site-packages/github/Repository.py @ 0:d67268158946 draft

planemo upload commit a3f181f5f126803c654b3a66dd4e83a48f7e203b
author bcclaywell
date Mon, 12 Oct 2015 17:43:33 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:d67268158946
1 # -*- coding: utf-8 -*-
2
3 # ########################## Copyrights and license ############################
4 # #
5 # Copyright 2012 Christopher Gilbert <christopher.john.gilbert@gmail.com> #
6 # Copyright 2012 Steve English <steve.english@navetas.com> #
7 # Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
8 # Copyright 2012 Zearin <zearin@gonk.net> #
9 # Copyright 2013 AKFish <akfish@gmail.com> #
10 # Copyright 2013 Adrian Petrescu <adrian.petrescu@maluuba.com> #
11 # Copyright 2013 Mark Roddy <markroddy@gmail.com> #
12 # Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
13 # Copyright 2013 martinqt <m.ki2@laposte.net> #
14 # #
15 # This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
16 # #
17 # PyGithub is free software: you can redistribute it and/or modify it under #
18 # the terms of the GNU Lesser General Public License as published by the Free #
19 # Software Foundation, either version 3 of the License, or (at your option) #
20 # any later version. #
21 # #
22 # PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
23 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
24 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
25 # details. #
26 # #
27 # You should have received a copy of the GNU Lesser General Public License #
28 # along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
29 # #
30 # ##############################################################################
31
32 import urllib
33 import datetime
34
35 import github.GithubObject
36 import github.PaginatedList
37
38 import github.Branch
39 import github.IssueEvent
40 import github.ContentFile
41 import github.Label
42 import github.GitBlob
43 import github.Organization
44 import github.GitRef
45 import github.Issue
46 import github.Repository
47 import github.PullRequest
48 import github.RepositoryKey
49 import github.NamedUser
50 import github.Milestone
51 import github.Comparison
52 import github.CommitComment
53 import github.GitCommit
54 import github.Team
55 import github.Commit
56 import github.GitTree
57 import github.Hook
58 import github.Tag
59 import github.GitTag
60 import github.Download
61 import github.Permissions
62 import github.Event
63 import github.Legacy
64 import github.StatsContributor
65 import github.StatsCommitActivity
66 import github.StatsCodeFrequency
67 import github.StatsParticipation
68 import github.StatsPunchCard
69
70
71 class Repository(github.GithubObject.CompletableGithubObject):
72 """
73 This class represents Repositorys. The reference can be found here http://developer.github.com/v3/repos/
74 """
75
76 @property
77 def archive_url(self):
78 """
79 :type: string
80 """
81 self._completeIfNotSet(self._archive_url)
82 return self._archive_url.value
83
84 @property
85 def assignees_url(self):
86 """
87 :type: string
88 """
89 self._completeIfNotSet(self._assignees_url)
90 return self._assignees_url.value
91
92 @property
93 def blobs_url(self):
94 """
95 :type: string
96 """
97 self._completeIfNotSet(self._blobs_url)
98 return self._blobs_url.value
99
100 @property
101 def branches_url(self):
102 """
103 :type: string
104 """
105 self._completeIfNotSet(self._branches_url)
106 return self._branches_url.value
107
108 @property
109 def clone_url(self):
110 """
111 :type: string
112 """
113 self._completeIfNotSet(self._clone_url)
114 return self._clone_url.value
115
116 @property
117 def collaborators_url(self):
118 """
119 :type: string
120 """
121 self._completeIfNotSet(self._collaborators_url)
122 return self._collaborators_url.value
123
124 @property
125 def comments_url(self):
126 """
127 :type: string
128 """
129 self._completeIfNotSet(self._comments_url)
130 return self._comments_url.value
131
132 @property
133 def commits_url(self):
134 """
135 :type: string
136 """
137 self._completeIfNotSet(self._commits_url)
138 return self._commits_url.value
139
140 @property
141 def compare_url(self):
142 """
143 :type: string
144 """
145 self._completeIfNotSet(self._compare_url)
146 return self._compare_url.value
147
148 @property
149 def contents_url(self):
150 """
151 :type: string
152 """
153 self._completeIfNotSet(self._contents_url)
154 return self._contents_url.value
155
156 @property
157 def contributors_url(self):
158 """
159 :type: string
160 """
161 self._completeIfNotSet(self._contributors_url)
162 return self._contributors_url.value
163
164 @property
165 def created_at(self):
166 """
167 :type: datetime.datetime
168 """
169 self._completeIfNotSet(self._created_at)
170 return self._created_at.value
171
172 @property
173 def default_branch(self):
174 """
175 :type: string
176 """
177 self._completeIfNotSet(self._default_branch)
178 return self._default_branch.value
179
180 @property
181 def description(self):
182 """
183 :type: string
184 """
185 self._completeIfNotSet(self._description)
186 return self._description.value
187
188 @property
189 def downloads_url(self):
190 """
191 :type: string
192 """
193 self._completeIfNotSet(self._downloads_url)
194 return self._downloads_url.value
195
196 @property
197 def events_url(self):
198 """
199 :type: string
200 """
201 self._completeIfNotSet(self._events_url)
202 return self._events_url.value
203
204 @property
205 def fork(self):
206 """
207 :type: bool
208 """
209 self._completeIfNotSet(self._fork)
210 return self._fork.value
211
212 @property
213 def forks(self):
214 """
215 :type: integer
216 """
217 self._completeIfNotSet(self._forks)
218 return self._forks.value
219
220 @property
221 def forks_count(self):
222 """
223 :type: integer
224 """
225 self._completeIfNotSet(self._forks_count)
226 return self._forks_count.value
227
228 @property
229 def forks_url(self):
230 """
231 :type: string
232 """
233 self._completeIfNotSet(self._forks_url)
234 return self._forks_url.value
235
236 @property
237 def full_name(self):
238 """
239 :type: string
240 """
241 self._completeIfNotSet(self._full_name)
242 return self._full_name.value
243
244 @property
245 def git_commits_url(self):
246 """
247 :type: string
248 """
249 self._completeIfNotSet(self._git_commits_url)
250 return self._git_commits_url.value
251
252 @property
253 def git_refs_url(self):
254 """
255 :type: string
256 """
257 self._completeIfNotSet(self._git_refs_url)
258 return self._git_refs_url.value
259
260 @property
261 def git_tags_url(self):
262 """
263 :type: string
264 """
265 self._completeIfNotSet(self._git_tags_url)
266 return self._git_tags_url.value
267
268 @property
269 def git_url(self):
270 """
271 :type: string
272 """
273 self._completeIfNotSet(self._git_url)
274 return self._git_url.value
275
276 @property
277 def has_downloads(self):
278 """
279 :type: bool
280 """
281 self._completeIfNotSet(self._has_downloads)
282 return self._has_downloads.value
283
284 @property
285 def has_issues(self):
286 """
287 :type: bool
288 """
289 self._completeIfNotSet(self._has_issues)
290 return self._has_issues.value
291
292 @property
293 def has_wiki(self):
294 """
295 :type: bool
296 """
297 self._completeIfNotSet(self._has_wiki)
298 return self._has_wiki.value
299
300 @property
301 def homepage(self):
302 """
303 :type: string
304 """
305 self._completeIfNotSet(self._homepage)
306 return self._homepage.value
307
308 @property
309 def hooks_url(self):
310 """
311 :type: string
312 """
313 self._completeIfNotSet(self._hooks_url)
314 return self._hooks_url.value
315
316 @property
317 def html_url(self):
318 """
319 :type: string
320 """
321 self._completeIfNotSet(self._html_url)
322 return self._html_url.value
323
324 @property
325 def id(self):
326 """
327 :type: integer
328 """
329 self._completeIfNotSet(self._id)
330 return self._id.value
331
332 @property
333 def issue_comment_url(self):
334 """
335 :type: string
336 """
337 self._completeIfNotSet(self._issue_comment_url)
338 return self._issue_comment_url.value
339
340 @property
341 def issue_events_url(self):
342 """
343 :type: string
344 """
345 self._completeIfNotSet(self._issue_events_url)
346 return self._issue_events_url.value
347
348 @property
349 def issues_url(self):
350 """
351 :type: string
352 """
353 self._completeIfNotSet(self._issues_url)
354 return self._issues_url.value
355
356 @property
357 def keys_url(self):
358 """
359 :type: string
360 """
361 self._completeIfNotSet(self._keys_url)
362 return self._keys_url.value
363
364 @property
365 def labels_url(self):
366 """
367 :type: string
368 """
369 self._completeIfNotSet(self._labels_url)
370 return self._labels_url.value
371
372 @property
373 def language(self):
374 """
375 :type: string
376 """
377 self._completeIfNotSet(self._language)
378 return self._language.value
379
380 @property
381 def languages_url(self):
382 """
383 :type: string
384 """
385 self._completeIfNotSet(self._languages_url)
386 return self._languages_url.value
387
388 @property
389 def master_branch(self):
390 """
391 :type: string
392 """
393 self._completeIfNotSet(self._master_branch)
394 return self._master_branch.value
395
396 @property
397 def merges_url(self):
398 """
399 :type: string
400 """
401 self._completeIfNotSet(self._merges_url)
402 return self._merges_url.value
403
404 @property
405 def milestones_url(self):
406 """
407 :type: string
408 """
409 self._completeIfNotSet(self._milestones_url)
410 return self._milestones_url.value
411
412 @property
413 def mirror_url(self):
414 """
415 :type: string
416 """
417 self._completeIfNotSet(self._mirror_url)
418 return self._mirror_url.value
419
420 @property
421 def name(self):
422 """
423 :type: string
424 """
425 self._completeIfNotSet(self._name)
426 return self._name.value
427
428 @property
429 def network_count(self):
430 """
431 :type: integer
432 """
433 self._completeIfNotSet(self._network_count)
434 return self._network_count.value
435
436 @property
437 def notifications_url(self):
438 """
439 :type: string
440 """
441 self._completeIfNotSet(self._notifications_url)
442 return self._notifications_url.value
443
444 @property
445 def open_issues(self):
446 """
447 :type: integer
448 """
449 self._completeIfNotSet(self._open_issues)
450 return self._open_issues.value
451
452 @property
453 def open_issues_count(self):
454 """
455 :type: integer
456 """
457 self._completeIfNotSet(self._open_issues_count)
458 return self._open_issues_count.value
459
460 @property
461 def organization(self):
462 """
463 :type: :class:`github.Organization.Organization`
464 """
465 self._completeIfNotSet(self._organization)
466 return self._organization.value
467
468 @property
469 def owner(self):
470 """
471 :type: :class:`github.NamedUser.NamedUser`
472 """
473 self._completeIfNotSet(self._owner)
474 return self._owner.value
475
476 @property
477 def parent(self):
478 """
479 :type: :class:`github.Repository.Repository`
480 """
481 self._completeIfNotSet(self._parent)
482 return self._parent.value
483
484 @property
485 def permissions(self):
486 """
487 :type: :class:`github.Permissions.Permissions`
488 """
489 self._completeIfNotSet(self._permissions)
490 return self._permissions.value
491
492 @property
493 def private(self):
494 """
495 :type: bool
496 """
497 self._completeIfNotSet(self._private)
498 return self._private.value
499
500 @property
501 def pulls_url(self):
502 """
503 :type: string
504 """
505 self._completeIfNotSet(self._pulls_url)
506 return self._pulls_url.value
507
508 @property
509 def pushed_at(self):
510 """
511 :type: datetime.datetime
512 """
513 self._completeIfNotSet(self._pushed_at)
514 return self._pushed_at.value
515
516 @property
517 def size(self):
518 """
519 :type: integer
520 """
521 self._completeIfNotSet(self._size)
522 return self._size.value
523
524 @property
525 def source(self):
526 """
527 :type: :class:`github.Repository.Repository`
528 """
529 self._completeIfNotSet(self._source)
530 return self._source.value
531
532 @property
533 def ssh_url(self):
534 """
535 :type: string
536 """
537 self._completeIfNotSet(self._ssh_url)
538 return self._ssh_url.value
539
540 @property
541 def stargazers_count(self):
542 """
543 :type: integer
544 """
545 self._completeIfNotSet(self._stargazers_count) # pragma no cover (Should be covered)
546 return self._stargazers_count.value # pragma no cover (Should be covered)
547
548 @property
549 def stargazers_url(self):
550 """
551 :type: string
552 """
553 self._completeIfNotSet(self._stargazers_url)
554 return self._stargazers_url.value
555
556 @property
557 def statuses_url(self):
558 """
559 :type: string
560 """
561 self._completeIfNotSet(self._statuses_url)
562 return self._statuses_url.value
563
564 @property
565 def subscribers_url(self):
566 """
567 :type: string
568 """
569 self._completeIfNotSet(self._subscribers_url)
570 return self._subscribers_url.value
571
572 @property
573 def subscription_url(self):
574 """
575 :type: string
576 """
577 self._completeIfNotSet(self._subscription_url)
578 return self._subscription_url.value
579
580 @property
581 def svn_url(self):
582 """
583 :type: string
584 """
585 self._completeIfNotSet(self._svn_url)
586 return self._svn_url.value
587
588 @property
589 def tags_url(self):
590 """
591 :type: string
592 """
593 self._completeIfNotSet(self._tags_url)
594 return self._tags_url.value
595
596 @property
597 def teams_url(self):
598 """
599 :type: string
600 """
601 self._completeIfNotSet(self._teams_url)
602 return self._teams_url.value
603
604 @property
605 def trees_url(self):
606 """
607 :type: string
608 """
609 self._completeIfNotSet(self._trees_url)
610 return self._trees_url.value
611
612 @property
613 def updated_at(self):
614 """
615 :type: datetime.datetime
616 """
617 self._completeIfNotSet(self._updated_at)
618 return self._updated_at.value
619
620 @property
621 def url(self):
622 """
623 :type: string
624 """
625 self._completeIfNotSet(self._url)
626 return self._url.value
627
628 @property
629 def watchers(self):
630 """
631 :type: integer
632 """
633 self._completeIfNotSet(self._watchers)
634 return self._watchers.value
635
636 @property
637 def watchers_count(self):
638 """
639 :type: integer
640 """
641 self._completeIfNotSet(self._watchers_count)
642 return self._watchers_count.value
643
644 def add_to_collaborators(self, collaborator):
645 """
646 :calls: `PUT /repos/:owner/:repo/collaborators/:user <http://developer.github.com/v3/repos/collaborators>`_
647 :param collaborator: string or :class:`github.NamedUser.NamedUser`
648 :rtype: None
649 """
650 assert isinstance(collaborator, github.NamedUser.NamedUser) or isinstance(collaborator, (str, unicode)), collaborator
651
652 if isinstance(collaborator, github.NamedUser.NamedUser):
653 collaborator = collaborator._identity
654
655 headers, data = self._requester.requestJsonAndCheck(
656 "PUT",
657 self.url + "/collaborators/" + collaborator
658 )
659
660 def compare(self, base, head):
661 """
662 :calls: `GET /repos/:owner/:repo/compare/:base...:head <http://developer.github.com/v3/repos/commits>`_
663 :param base: string
664 :param head: string
665 :rtype: :class:`github.Comparison.Comparison`
666 """
667 assert isinstance(base, (str, unicode)), base
668 assert isinstance(head, (str, unicode)), head
669 headers, data = self._requester.requestJsonAndCheck(
670 "GET",
671 self.url + "/compare/" + base + "..." + head
672 )
673 return github.Comparison.Comparison(self._requester, headers, data, completed=True)
674
675 def create_git_blob(self, content, encoding):
676 """
677 :calls: `POST /repos/:owner/:repo/git/blobs <http://developer.github.com/v3/git/blobs>`_
678 :param content: string
679 :param encoding: string
680 :rtype: :class:`github.GitBlob.GitBlob`
681 """
682 assert isinstance(content, (str, unicode)), content
683 assert isinstance(encoding, (str, unicode)), encoding
684 post_parameters = {
685 "content": content,
686 "encoding": encoding,
687 }
688 headers, data = self._requester.requestJsonAndCheck(
689 "POST",
690 self.url + "/git/blobs",
691 input=post_parameters
692 )
693 return github.GitBlob.GitBlob(self._requester, headers, data, completed=True)
694
695 def create_git_commit(self, message, tree, parents, author=github.GithubObject.NotSet, committer=github.GithubObject.NotSet):
696 """
697 :calls: `POST /repos/:owner/:repo/git/commits <http://developer.github.com/v3/git/commits>`_
698 :param message: string
699 :param tree: :class:`github.GitTree.GitTree`
700 :param parents: list of :class:`github.GitCommit.GitCommit`
701 :param author: :class:`github.InputGitAuthor.InputGitAuthor`
702 :param committer: :class:`github.InputGitAuthor.InputGitAuthor`
703 :rtype: :class:`github.GitCommit.GitCommit`
704 """
705 assert isinstance(message, (str, unicode)), message
706 assert isinstance(tree, github.GitTree.GitTree), tree
707 assert all(isinstance(element, github.GitCommit.GitCommit) for element in parents), parents
708 assert author is github.GithubObject.NotSet or isinstance(author, github.InputGitAuthor), author
709 assert committer is github.GithubObject.NotSet or isinstance(committer, github.InputGitAuthor), committer
710 post_parameters = {
711 "message": message,
712 "tree": tree._identity,
713 "parents": [element._identity for element in parents],
714 }
715 if author is not github.GithubObject.NotSet:
716 post_parameters["author"] = author._identity
717 if committer is not github.GithubObject.NotSet:
718 post_parameters["committer"] = committer._identity
719 headers, data = self._requester.requestJsonAndCheck(
720 "POST",
721 self.url + "/git/commits",
722 input=post_parameters
723 )
724 return github.GitCommit.GitCommit(self._requester, headers, data, completed=True)
725
726 def create_git_ref(self, ref, sha):
727 """
728 :calls: `POST /repos/:owner/:repo/git/refs <http://developer.github.com/v3/git/refs>`_
729 :param ref: string
730 :param sha: string
731 :rtype: :class:`github.GitRef.GitRef`
732 """
733 assert isinstance(ref, (str, unicode)), ref
734 assert isinstance(sha, (str, unicode)), sha
735 post_parameters = {
736 "ref": ref,
737 "sha": sha,
738 }
739 headers, data = self._requester.requestJsonAndCheck(
740 "POST",
741 self.url + "/git/refs",
742 input=post_parameters
743 )
744 return github.GitRef.GitRef(self._requester, headers, data, completed=True)
745
746 def create_git_tag(self, tag, message, object, type, tagger=github.GithubObject.NotSet):
747 """
748 :calls: `POST /repos/:owner/:repo/git/tags <http://developer.github.com/v3/git/tags>`_
749 :param tag: string
750 :param message: string
751 :param object: string
752 :param type: string
753 :param tagger: :class:`github.InputGitAuthor.InputGitAuthor`
754 :rtype: :class:`github.GitTag.GitTag`
755 """
756 assert isinstance(tag, (str, unicode)), tag
757 assert isinstance(message, (str, unicode)), message
758 assert isinstance(object, (str, unicode)), object
759 assert isinstance(type, (str, unicode)), type
760 assert tagger is github.GithubObject.NotSet or isinstance(tagger, github.InputGitAuthor), tagger
761 post_parameters = {
762 "tag": tag,
763 "message": message,
764 "object": object,
765 "type": type,
766 }
767 if tagger is not github.GithubObject.NotSet:
768 post_parameters["tagger"] = tagger._identity
769 headers, data = self._requester.requestJsonAndCheck(
770 "POST",
771 self.url + "/git/tags",
772 input=post_parameters
773 )
774 return github.GitTag.GitTag(self._requester, headers, data, completed=True)
775
776 def create_git_tree(self, tree, base_tree=github.GithubObject.NotSet):
777 """
778 :calls: `POST /repos/:owner/:repo/git/trees <http://developer.github.com/v3/git/trees>`_
779 :param tree: list of :class:`github.InputGitTreeElement.InputGitTreeElement`
780 :param base_tree: :class:`github.GitTree.GitTree`
781 :rtype: :class:`github.GitTree.GitTree`
782 """
783 assert all(isinstance(element, github.InputGitTreeElement) for element in tree), tree
784 assert base_tree is github.GithubObject.NotSet or isinstance(base_tree, github.GitTree.GitTree), base_tree
785 post_parameters = {
786 "tree": [element._identity for element in tree],
787 }
788 if base_tree is not github.GithubObject.NotSet:
789 post_parameters["base_tree"] = base_tree._identity
790 headers, data = self._requester.requestJsonAndCheck(
791 "POST",
792 self.url + "/git/trees",
793 input=post_parameters
794 )
795 return github.GitTree.GitTree(self._requester, headers, data, completed=True)
796
797 def create_hook(self, name, config, events=github.GithubObject.NotSet, active=github.GithubObject.NotSet):
798 """
799 :calls: `POST /repos/:owner/:repo/hooks <http://developer.github.com/v3/repos/hooks>`_
800 :param name: string
801 :param config: dict
802 :param events: list of string
803 :param active: bool
804 :rtype: :class:`github.Hook.Hook`
805 """
806 assert isinstance(name, (str, unicode)), name
807 assert isinstance(config, dict), config
808 assert events is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in events), events
809 assert active is github.GithubObject.NotSet or isinstance(active, bool), active
810 post_parameters = {
811 "name": name,
812 "config": config,
813 }
814 if events is not github.GithubObject.NotSet:
815 post_parameters["events"] = events
816 if active is not github.GithubObject.NotSet:
817 post_parameters["active"] = active
818 headers, data = self._requester.requestJsonAndCheck(
819 "POST",
820 self.url + "/hooks",
821 input=post_parameters
822 )
823 return github.Hook.Hook(self._requester, headers, data, completed=True)
824
825 def create_issue(self, title, body=github.GithubObject.NotSet, assignee=github.GithubObject.NotSet, milestone=github.GithubObject.NotSet, labels=github.GithubObject.NotSet):
826 """
827 :calls: `POST /repos/:owner/:repo/issues <http://developer.github.com/v3/issues>`_
828 :param title: string
829 :param body: string
830 :param assignee: string or :class:`github.NamedUser.NamedUser`
831 :param milestone: :class:`github.Milestone.Milestone`
832 :param labels: list of :class:`github.Label.Label`
833 :rtype: :class:`github.Issue.Issue`
834 """
835 assert isinstance(title, (str, unicode)), title
836 assert body is github.GithubObject.NotSet or isinstance(body, (str, unicode)), body
837 assert assignee is github.GithubObject.NotSet or isinstance(assignee, github.NamedUser.NamedUser) or isinstance(assignee, (str, unicode)), assignee
838 assert milestone is github.GithubObject.NotSet or isinstance(milestone, github.Milestone.Milestone), milestone
839 assert labels is github.GithubObject.NotSet or all(isinstance(element, github.Label.Label) for element in labels), labels
840 post_parameters = {
841 "title": title,
842 }
843 if body is not github.GithubObject.NotSet:
844 post_parameters["body"] = body
845 if assignee is not github.GithubObject.NotSet:
846 if isinstance(assignee, (str, unicode)):
847 post_parameters["assignee"] = assignee
848 else:
849 post_parameters["assignee"] = assignee._identity
850 if milestone is not github.GithubObject.NotSet:
851 post_parameters["milestone"] = milestone._identity
852 if labels is not github.GithubObject.NotSet:
853 post_parameters["labels"] = [element.name for element in labels]
854 headers, data = self._requester.requestJsonAndCheck(
855 "POST",
856 self.url + "/issues",
857 input=post_parameters
858 )
859 return github.Issue.Issue(self._requester, headers, data, completed=True)
860
861 def create_key(self, title, key):
862 """
863 :calls: `POST /repos/:owner/:repo/keys <http://developer.github.com/v3/repos/keys>`_
864 :param title: string
865 :param key: string
866 :rtype: :class:`github.RepositoryKey.RepositoryKey`
867 """
868 assert isinstance(title, (str, unicode)), title
869 assert isinstance(key, (str, unicode)), key
870 post_parameters = {
871 "title": title,
872 "key": key,
873 }
874 headers, data = self._requester.requestJsonAndCheck(
875 "POST",
876 self.url + "/keys",
877 input=post_parameters
878 )
879 return github.RepositoryKey.RepositoryKey(self._requester, headers, data, completed=True, repoUrl=self.url)
880
881 def create_label(self, name, color):
882 """
883 :calls: `POST /repos/:owner/:repo/labels <http://developer.github.com/v3/issues/labels>`_
884 :param name: string
885 :param color: string
886 :rtype: :class:`github.Label.Label`
887 """
888 assert isinstance(name, (str, unicode)), name
889 assert isinstance(color, (str, unicode)), color
890 post_parameters = {
891 "name": name,
892 "color": color,
893 }
894 headers, data = self._requester.requestJsonAndCheck(
895 "POST",
896 self.url + "/labels",
897 input=post_parameters
898 )
899 return github.Label.Label(self._requester, headers, data, completed=True)
900
901 def create_milestone(self, title, state=github.GithubObject.NotSet, description=github.GithubObject.NotSet, due_on=github.GithubObject.NotSet):
902 """
903 :calls: `POST /repos/:owner/:repo/milestones <http://developer.github.com/v3/issues/milestones>`_
904 :param title: string
905 :param state: string
906 :param description: string
907 :param due_on: date
908 :rtype: :class:`github.Milestone.Milestone`
909 """
910 assert isinstance(title, (str, unicode)), title
911 assert state is github.GithubObject.NotSet or isinstance(state, (str, unicode)), state
912 assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description
913 assert due_on is github.GithubObject.NotSet or isinstance(due_on, datetime.date), due_on
914 post_parameters = {
915 "title": title,
916 }
917 if state is not github.GithubObject.NotSet:
918 post_parameters["state"] = state
919 if description is not github.GithubObject.NotSet:
920 post_parameters["description"] = description
921 if due_on is not github.GithubObject.NotSet:
922 post_parameters["due_on"] = due_on.strftime("%Y-%m-%d")
923 headers, data = self._requester.requestJsonAndCheck(
924 "POST",
925 self.url + "/milestones",
926 input=post_parameters
927 )
928 return github.Milestone.Milestone(self._requester, headers, data, completed=True)
929
930 def create_pull(self, *args, **kwds):
931 """
932 :calls: `POST /repos/:owner/:repo/pulls <http://developer.github.com/v3/pulls>`_
933 :param title: string
934 :param body: string
935 :param issue: :class:`github.Issue.Issue`
936 :param base: string
937 :param head: string
938 :rtype: :class:`github.PullRequest.PullRequest`
939 """
940 if len(args) + len(kwds) == 4:
941 return self.__create_pull_1(*args, **kwds)
942 else:
943 return self.__create_pull_2(*args, **kwds)
944
945 def __create_pull_1(self, title, body, base, head):
946 assert isinstance(title, (str, unicode)), title
947 assert isinstance(body, (str, unicode)), body
948 assert isinstance(base, (str, unicode)), base
949 assert isinstance(head, (str, unicode)), head
950 return self.__create_pull(title=title, body=body, base=base, head=head)
951
952 def __create_pull_2(self, issue, base, head):
953 assert isinstance(issue, github.Issue.Issue), issue
954 assert isinstance(base, (str, unicode)), base
955 assert isinstance(head, (str, unicode)), head
956 return self.__create_pull(issue=issue._identity, base=base, head=head)
957
958 def __create_pull(self, **kwds):
959 post_parameters = kwds
960 headers, data = self._requester.requestJsonAndCheck(
961 "POST",
962 self.url + "/pulls",
963 input=post_parameters
964 )
965 return github.PullRequest.PullRequest(self._requester, headers, data, completed=True)
966
967 def delete(self):
968 """
969 :calls: `DELETE /repos/:owner/:repo <http://developer.github.com/v3/repos>`_
970 :rtype: None
971 """
972 headers, data = self._requester.requestJsonAndCheck(
973 "DELETE",
974 self.url
975 )
976
977 def edit(self, name, description=github.GithubObject.NotSet, homepage=github.GithubObject.NotSet, private=github.GithubObject.NotSet, has_issues=github.GithubObject.NotSet, has_wiki=github.GithubObject.NotSet, has_downloads=github.GithubObject.NotSet, default_branch=github.GithubObject.NotSet):
978 """
979 :calls: `PATCH /repos/:owner/:repo <http://developer.github.com/v3/repos>`_
980 :param name: string
981 :param description: string
982 :param homepage: string
983 :param private: bool
984 :param has_issues: bool
985 :param has_wiki: bool
986 :param has_downloads: bool
987 :param default_branch: string
988 :rtype: None
989 """
990 assert isinstance(name, (str, unicode)), name
991 assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description
992 assert homepage is github.GithubObject.NotSet or isinstance(homepage, (str, unicode)), homepage
993 assert private is github.GithubObject.NotSet or isinstance(private, bool), private
994 assert has_issues is github.GithubObject.NotSet or isinstance(has_issues, bool), has_issues
995 assert has_wiki is github.GithubObject.NotSet or isinstance(has_wiki, bool), has_wiki
996 assert has_downloads is github.GithubObject.NotSet or isinstance(has_downloads, bool), has_downloads
997 assert default_branch is github.GithubObject.NotSet or isinstance(default_branch, (str, unicode)), default_branch
998 post_parameters = {
999 "name": name,
1000 }
1001 if description is not github.GithubObject.NotSet:
1002 post_parameters["description"] = description
1003 if homepage is not github.GithubObject.NotSet:
1004 post_parameters["homepage"] = homepage
1005 if private is not github.GithubObject.NotSet:
1006 post_parameters["private"] = private
1007 if has_issues is not github.GithubObject.NotSet:
1008 post_parameters["has_issues"] = has_issues
1009 if has_wiki is not github.GithubObject.NotSet:
1010 post_parameters["has_wiki"] = has_wiki
1011 if has_downloads is not github.GithubObject.NotSet:
1012 post_parameters["has_downloads"] = has_downloads
1013 if default_branch is not github.GithubObject.NotSet:
1014 post_parameters["default_branch"] = default_branch
1015 headers, data = self._requester.requestJsonAndCheck(
1016 "PATCH",
1017 self.url,
1018 input=post_parameters
1019 )
1020 self._useAttributes(data)
1021
1022 def get_archive_link(self, archive_format, ref=github.GithubObject.NotSet):
1023 """
1024 :calls: `GET /repos/:owner/:repo/:archive_format/:ref <http://developer.github.com/v3/repos/contents>`_
1025 :param archive_format: string
1026 :param ref: string
1027 :rtype: string
1028 """
1029 assert isinstance(archive_format, (str, unicode)), archive_format
1030 assert ref is github.GithubObject.NotSet or isinstance(ref, (str, unicode)), ref
1031 url = self.url + "/" + archive_format
1032 if ref is not github.GithubObject.NotSet:
1033 url += "/" + ref
1034 headers, data = self._requester.requestJsonAndCheck(
1035 "GET",
1036 url
1037 )
1038 return headers["location"]
1039
1040 def get_assignees(self):
1041 """
1042 :calls: `GET /repos/:owner/:repo/assignees <http://developer.github.com/v3/issues/assignees>`_
1043 :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.NamedUser.NamedUser`
1044 """
1045 return github.PaginatedList.PaginatedList(
1046 github.NamedUser.NamedUser,
1047 self._requester,
1048 self.url + "/assignees",
1049 None
1050 )
1051
1052 def get_branch(self, branch):
1053 """
1054 :calls: `GET /repos/:owner/:repo/branches/:branch <http://developer.github.com/v3/repos>`_
1055 :param branch: string
1056 :rtype: :class:`github.Branch.Branch`
1057 """
1058 assert isinstance(branch, (str, unicode)), branch
1059 headers, data = self._requester.requestJsonAndCheck(
1060 "GET",
1061 self.url + "/branches/" + branch
1062 )
1063 return github.Branch.Branch(self._requester, headers, data, completed=True)
1064
1065 def get_branches(self):
1066 """
1067 :calls: `GET /repos/:owner/:repo/branches <http://developer.github.com/v3/repos>`_
1068 :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Branch.Branch`
1069 """
1070 return github.PaginatedList.PaginatedList(
1071 github.Branch.Branch,
1072 self._requester,
1073 self.url + "/branches",
1074 None
1075 )
1076
1077 def get_collaborators(self):
1078 """
1079 :calls: `GET /repos/:owner/:repo/collaborators <http://developer.github.com/v3/repos/collaborators>`_
1080 :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.NamedUser.NamedUser`
1081 """
1082 return github.PaginatedList.PaginatedList(
1083 github.NamedUser.NamedUser,
1084 self._requester,
1085 self.url + "/collaborators",
1086 None
1087 )
1088
1089 def get_comment(self, id):
1090 """
1091 :calls: `GET /repos/:owner/:repo/comments/:id <http://developer.github.com/v3/repos/comments>`_
1092 :param id: integer
1093 :rtype: :class:`github.CommitComment.CommitComment`
1094 """
1095 assert isinstance(id, (int, long)), id
1096 headers, data = self._requester.requestJsonAndCheck(
1097 "GET",
1098 self.url + "/comments/" + str(id)
1099 )
1100 return github.CommitComment.CommitComment(self._requester, headers, data, completed=True)
1101
1102 def get_comments(self):
1103 """
1104 :calls: `GET /repos/:owner/:repo/comments <http://developer.github.com/v3/repos/comments>`_
1105 :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.CommitComment.CommitComment`
1106 """
1107 return github.PaginatedList.PaginatedList(
1108 github.CommitComment.CommitComment,
1109 self._requester,
1110 self.url + "/comments",
1111 None
1112 )
1113
1114 def get_commit(self, sha):
1115 """
1116 :calls: `GET /repos/:owner/:repo/commits/:sha <http://developer.github.com/v3/repos/commits>`_
1117 :param sha: string
1118 :rtype: :class:`github.Commit.Commit`
1119 """
1120 assert isinstance(sha, (str, unicode)), sha
1121 headers, data = self._requester.requestJsonAndCheck(
1122 "GET",
1123 self.url + "/commits/" + sha
1124 )
1125 return github.Commit.Commit(self._requester, headers, data, completed=True)
1126
1127 def get_commits(self, sha=github.GithubObject.NotSet, path=github.GithubObject.NotSet, since=github.GithubObject.NotSet, until=github.GithubObject.NotSet, author=github.GithubObject.NotSet):
1128 """
1129 :calls: `GET /repos/:owner/:repo/commits <http://developer.github.com/v3/repos/commits>`_
1130 :param sha: string
1131 :param path: string
1132 :param since: datetime.datetime
1133 :param until: datetime.datetime
1134 :param author: string or :class:`github.NamedUser.NamedUser` or :class:`github.AuthenticatedUser.AuthenticatedUser`
1135 :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Commit.Commit`
1136 """
1137 assert sha is github.GithubObject.NotSet or isinstance(sha, (str, unicode)), sha
1138 assert path is github.GithubObject.NotSet or isinstance(path, (str, unicode)), path
1139 assert since is github.GithubObject.NotSet or isinstance(since, datetime.datetime), since
1140 assert until is github.GithubObject.NotSet or isinstance(until, datetime.datetime), until
1141 assert author is github.GithubObject.NotSet or isinstance(author, (str, unicode, github.NamedUser.NamedUser, github.AuthenticatedUser.AuthenticatedUser)), author
1142 url_parameters = dict()
1143 if sha is not github.GithubObject.NotSet:
1144 url_parameters["sha"] = sha
1145 if path is not github.GithubObject.NotSet:
1146 url_parameters["path"] = path
1147 if since is not github.GithubObject.NotSet:
1148 url_parameters["since"] = since.strftime("%Y-%m-%dT%H:%M:%SZ")
1149 if until is not github.GithubObject.NotSet:
1150 url_parameters["until"] = until.strftime("%Y-%m-%dT%H:%M:%SZ")
1151 if author is not github.GithubObject.NotSet:
1152 if isinstance(author, (github.NamedUser.NamedUser, github.AuthenticatedUser.AuthenticatedUser)):
1153 url_parameters["author"] = author.login
1154 else:
1155 url_parameters["author"] = author
1156 return github.PaginatedList.PaginatedList(
1157 github.Commit.Commit,
1158 self._requester,
1159 self.url + "/commits",
1160 url_parameters
1161 )
1162
1163 def get_contents(self, path, ref=github.GithubObject.NotSet):
1164 """
1165 :calls: `GET /repos/:owner/:repo/contents/:path <http://developer.github.com/v3/repos/contents>`_
1166 :param path: string
1167 :param ref: string
1168 :rtype: :class:`github.ContentFile.ContentFile`
1169 """
1170 return self.get_file_contents(path, ref)
1171
1172 def get_file_contents(self, path, ref=github.GithubObject.NotSet):
1173 """
1174 :calls: `GET /repos/:owner/:repo/contents/:path <http://developer.github.com/v3/repos/contents>`_
1175 :param path: string
1176 :param ref: string
1177 :rtype: :class:`github.ContentFile.ContentFile`
1178 """
1179 assert isinstance(path, (str, unicode)), path
1180 assert ref is github.GithubObject.NotSet or isinstance(ref, (str, unicode)), ref
1181 url_parameters = dict()
1182 if ref is not github.GithubObject.NotSet:
1183 url_parameters["ref"] = ref
1184 headers, data = self._requester.requestJsonAndCheck(
1185 "GET",
1186 self.url + "/contents" + path,
1187 parameters=url_parameters
1188 )
1189 return github.ContentFile.ContentFile(self._requester, headers, data, completed=True)
1190
1191 def get_dir_contents(self, path, ref=github.GithubObject.NotSet):
1192 """
1193 :calls: `GET /repos/:owner/:repo/contents/:path <http://developer.github.com/v3/repos/contents>`_
1194 :param path: string
1195 :param ref: string
1196 :rtype: list of :class:`github.ContentFile.ContentFile`
1197 """
1198 assert isinstance(path, (str, unicode)), path
1199 assert ref is github.GithubObject.NotSet or isinstance(ref, (str, unicode)), ref
1200 url_parameters = dict()
1201 if ref is not github.GithubObject.NotSet:
1202 url_parameters["ref"] = ref
1203 headers, data = self._requester.requestJsonAndCheck(
1204 "GET",
1205 self.url + "/contents" + path,
1206 parameters=url_parameters
1207 )
1208
1209 # Handle 302 redirect response
1210 if headers.get('status') == '302 Found' and headers.get('location'):
1211 headers, data = self._requester.requestJsonAndCheck(
1212 "GET",
1213 headers['location'],
1214 parameters=url_parameters
1215 )
1216
1217 return [
1218 github.ContentFile.ContentFile(self._requester, headers, attributes, completed=(attributes["type"] != "file")) # Lazy completion only makes sense for files. See discussion here: https://github.com/jacquev6/PyGithub/issues/140#issuecomment-13481130
1219 for attributes in data
1220 ]
1221
1222 def get_contributors(self):
1223 """
1224 :calls: `GET /repos/:owner/:repo/contributors <http://developer.github.com/v3/repos>`_
1225 :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.NamedUser.NamedUser`
1226 """
1227 return github.PaginatedList.PaginatedList(
1228 github.NamedUser.NamedUser,
1229 self._requester,
1230 self.url + "/contributors",
1231 None
1232 )
1233
1234 def get_download(self, id):
1235 """
1236 :calls: `GET /repos/:owner/:repo/downloads/:id <http://developer.github.com/v3/repos/downloads>`_
1237 :param id: integer
1238 :rtype: :class:`github.Download.Download`
1239 """
1240 assert isinstance(id, (int, long)), id
1241 headers, data = self._requester.requestJsonAndCheck(
1242 "GET",
1243 self.url + "/downloads/" + str(id)
1244 )
1245 return github.Download.Download(self._requester, headers, data, completed=True)
1246
1247 def get_downloads(self):
1248 """
1249 :calls: `GET /repos/:owner/:repo/downloads <http://developer.github.com/v3/repos/downloads>`_
1250 :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Download.Download`
1251 """
1252 return github.PaginatedList.PaginatedList(
1253 github.Download.Download,
1254 self._requester,
1255 self.url + "/downloads",
1256 None
1257 )
1258
1259 def get_events(self):
1260 """
1261 :calls: `GET /repos/:owner/:repo/events <http://developer.github.com/v3/activity/events>`_
1262 :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Event.Event`
1263 """
1264 return github.PaginatedList.PaginatedList(
1265 github.Event.Event,
1266 self._requester,
1267 self.url + "/events",
1268 None
1269 )
1270
1271 def get_forks(self):
1272 """
1273 :calls: `GET /repos/:owner/:repo/forks <http://developer.github.com/v3/repos/forks>`_
1274 :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Repository.Repository`
1275 """
1276 return github.PaginatedList.PaginatedList(
1277 Repository,
1278 self._requester,
1279 self.url + "/forks",
1280 None
1281 )
1282
1283 def get_git_blob(self, sha):
1284 """
1285 :calls: `GET /repos/:owner/:repo/git/blobs/:sha <http://developer.github.com/v3/git/blobs>`_
1286 :param sha: string
1287 :rtype: :class:`github.GitBlob.GitBlob`
1288 """
1289 assert isinstance(sha, (str, unicode)), sha
1290 headers, data = self._requester.requestJsonAndCheck(
1291 "GET",
1292 self.url + "/git/blobs/" + sha
1293 )
1294 return github.GitBlob.GitBlob(self._requester, headers, data, completed=True)
1295
1296 def get_git_commit(self, sha):
1297 """
1298 :calls: `GET /repos/:owner/:repo/git/commits/:sha <http://developer.github.com/v3/git/commits>`_
1299 :param sha: string
1300 :rtype: :class:`github.GitCommit.GitCommit`
1301 """
1302 assert isinstance(sha, (str, unicode)), sha
1303 headers, data = self._requester.requestJsonAndCheck(
1304 "GET",
1305 self.url + "/git/commits/" + sha
1306 )
1307 return github.GitCommit.GitCommit(self._requester, headers, data, completed=True)
1308
1309 def get_git_ref(self, ref):
1310 """
1311 :calls: `GET /repos/:owner/:repo/git/refs/:ref <http://developer.github.com/v3/git/refs>`_
1312 :param ref: string
1313 :rtype: :class:`github.GitRef.GitRef`
1314 """
1315 prefix = "/git/refs/"
1316 if not self._requester.FIX_REPO_GET_GIT_REF:
1317 prefix = "/git/"
1318 assert isinstance(ref, (str, unicode)), ref
1319 headers, data = self._requester.requestJsonAndCheck(
1320 "GET",
1321 self.url + prefix + ref
1322 )
1323 return github.GitRef.GitRef(self._requester, headers, data, completed=True)
1324
1325 def get_git_refs(self):
1326 """
1327 :calls: `GET /repos/:owner/:repo/git/refs <http://developer.github.com/v3/git/refs>`_
1328 :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.GitRef.GitRef`
1329 """
1330 return github.PaginatedList.PaginatedList(
1331 github.GitRef.GitRef,
1332 self._requester,
1333 self.url + "/git/refs",
1334 None
1335 )
1336
1337 def get_git_tag(self, sha):
1338 """
1339 :calls: `GET /repos/:owner/:repo/git/tags/:sha <http://developer.github.com/v3/git/tags>`_
1340 :param sha: string
1341 :rtype: :class:`github.GitTag.GitTag`
1342 """
1343 assert isinstance(sha, (str, unicode)), sha
1344 headers, data = self._requester.requestJsonAndCheck(
1345 "GET",
1346 self.url + "/git/tags/" + sha
1347 )
1348 return github.GitTag.GitTag(self._requester, headers, data, completed=True)
1349
1350 def get_git_tree(self, sha, recursive=github.GithubObject.NotSet):
1351 """
1352 :calls: `GET /repos/:owner/:repo/git/trees/:sha <http://developer.github.com/v3/git/trees>`_
1353 :param sha: string
1354 :param recursive: bool
1355 :rtype: :class:`github.GitTree.GitTree`
1356 """
1357 assert isinstance(sha, (str, unicode)), sha
1358 assert recursive is github.GithubObject.NotSet or isinstance(recursive, bool), recursive
1359 url_parameters = dict()
1360 if recursive is not github.GithubObject.NotSet:
1361 url_parameters["recursive"] = recursive
1362 headers, data = self._requester.requestJsonAndCheck(
1363 "GET",
1364 self.url + "/git/trees/" + sha,
1365 parameters=url_parameters
1366 )
1367 return github.GitTree.GitTree(self._requester, headers, data, completed=True)
1368
1369 def get_hook(self, id):
1370 """
1371 :calls: `GET /repos/:owner/:repo/hooks/:id <http://developer.github.com/v3/repos/hooks>`_
1372 :param id: integer
1373 :rtype: :class:`github.Hook.Hook`
1374 """
1375 assert isinstance(id, (int, long)), id
1376 headers, data = self._requester.requestJsonAndCheck(
1377 "GET",
1378 self.url + "/hooks/" + str(id)
1379 )
1380 return github.Hook.Hook(self._requester, headers, data, completed=True)
1381
1382 def get_hooks(self):
1383 """
1384 :calls: `GET /repos/:owner/:repo/hooks <http://developer.github.com/v3/repos/hooks>`_
1385 :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Hook.Hook`
1386 """
1387 return github.PaginatedList.PaginatedList(
1388 github.Hook.Hook,
1389 self._requester,
1390 self.url + "/hooks",
1391 None
1392 )
1393
1394 def get_issue(self, number):
1395 """
1396 :calls: `GET /repos/:owner/:repo/issues/:number <http://developer.github.com/v3/issues>`_
1397 :param number: integer
1398 :rtype: :class:`github.Issue.Issue`
1399 """
1400 assert isinstance(number, (int, long)), number
1401 headers, data = self._requester.requestJsonAndCheck(
1402 "GET",
1403 self.url + "/issues/" + str(number)
1404 )
1405 return github.Issue.Issue(self._requester, headers, data, completed=True)
1406
1407 def get_issues(self, milestone=github.GithubObject.NotSet, state=github.GithubObject.NotSet, assignee=github.GithubObject.NotSet, mentioned=github.GithubObject.NotSet, labels=github.GithubObject.NotSet, sort=github.GithubObject.NotSet, direction=github.GithubObject.NotSet, since=github.GithubObject.NotSet):
1408 """
1409 :calls: `GET /repos/:owner/:repo/issues <http://developer.github.com/v3/issues>`_
1410 :param milestone: :class:`github.Milestone.Milestone` or "none" or "*"
1411 :param state: string
1412 :param assignee: string or :class:`github.NamedUser.NamedUser` or "none" or "*"
1413 :param mentioned: :class:`github.NamedUser.NamedUser`
1414 :param labels: list of :class:`github.Label.Label`
1415 :param sort: string
1416 :param direction: string
1417 :param since: datetime.datetime
1418 :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Issue.Issue`
1419 """
1420 assert milestone is github.GithubObject.NotSet or milestone == "*" or milestone == "none" or isinstance(milestone, github.Milestone.Milestone), milestone
1421 assert state is github.GithubObject.NotSet or isinstance(state, (str, unicode)), state
1422 assert assignee is github.GithubObject.NotSet or isinstance(assignee, github.NamedUser.NamedUser) or isinstance(assignee, (str, unicode)), assignee
1423 assert mentioned is github.GithubObject.NotSet or isinstance(mentioned, github.NamedUser.NamedUser), mentioned
1424 assert labels is github.GithubObject.NotSet or all(isinstance(element, github.Label.Label) for element in labels), labels
1425 assert sort is github.GithubObject.NotSet or isinstance(sort, (str, unicode)), sort
1426 assert direction is github.GithubObject.NotSet or isinstance(direction, (str, unicode)), direction
1427 assert since is github.GithubObject.NotSet or isinstance(since, datetime.datetime), since
1428 url_parameters = dict()
1429 if milestone is not github.GithubObject.NotSet:
1430 if isinstance(milestone, str):
1431 url_parameters["milestone"] = milestone
1432 else:
1433 url_parameters["milestone"] = milestone._identity
1434 if state is not github.GithubObject.NotSet:
1435 url_parameters["state"] = state
1436 if assignee is not github.GithubObject.NotSet:
1437 if isinstance(assignee, str):
1438 url_parameters["assignee"] = assignee
1439 else:
1440 url_parameters["assignee"] = assignee._identity
1441 if mentioned is not github.GithubObject.NotSet:
1442 url_parameters["mentioned"] = mentioned._identity
1443 if labels is not github.GithubObject.NotSet:
1444 url_parameters["labels"] = ",".join(label.name for label in labels)
1445 if sort is not github.GithubObject.NotSet:
1446 url_parameters["sort"] = sort
1447 if direction is not github.GithubObject.NotSet:
1448 url_parameters["direction"] = direction
1449 if since is not github.GithubObject.NotSet:
1450 url_parameters["since"] = since.strftime("%Y-%m-%dT%H:%M:%SZ")
1451 return github.PaginatedList.PaginatedList(
1452 github.Issue.Issue,
1453 self._requester,
1454 self.url + "/issues",
1455 url_parameters
1456 )
1457
1458 def get_issues_comments(self, sort=github.GithubObject.NotSet, direction=github.GithubObject.NotSet, since=github.GithubObject.NotSet):
1459 """
1460 :calls: `GET /repos/:owner/:repo/issues/comments <http://developer.github.com/v3/issues/comments>`_
1461 :param sort: string
1462 :param direction: string
1463 :param since: datetime.datetime
1464 :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.IssueComment.IssueComment`
1465 """
1466 assert sort is github.GithubObject.NotSet or isinstance(sort, (str, unicode)), sort
1467 assert direction is github.GithubObject.NotSet or isinstance(direction, (str, unicode)), direction
1468 assert since is github.GithubObject.NotSet or isinstance(since, datetime.datetime), since
1469 url_parameters = dict()
1470 if sort is not github.GithubObject.NotSet:
1471 url_parameters["sort"] = sort
1472 if direction is not github.GithubObject.NotSet:
1473 url_parameters["direction"] = direction
1474 if since is not github.GithubObject.NotSet:
1475 url_parameters["since"] = since.strftime("%Y-%m-%dT%H:%M:%SZ")
1476 return github.PaginatedList.PaginatedList(
1477 github.IssueComment.IssueComment,
1478 self._requester,
1479 self.url + "/issues/comments",
1480 url_parameters
1481 )
1482
1483 def get_issues_event(self, id):
1484 """
1485 :calls: `GET /repos/:owner/:repo/issues/events/:id <http://developer.github.com/v3/issues/events>`_
1486 :param id: integer
1487 :rtype: :class:`github.IssueEvent.IssueEvent`
1488 """
1489 assert isinstance(id, (int, long)), id
1490 headers, data = self._requester.requestJsonAndCheck(
1491 "GET",
1492 self.url + "/issues/events/" + str(id)
1493 )
1494 return github.IssueEvent.IssueEvent(self._requester, headers, data, completed=True)
1495
1496 def get_issues_events(self):
1497 """
1498 :calls: `GET /repos/:owner/:repo/issues/events <http://developer.github.com/v3/issues/events>`_
1499 :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.IssueEvent.IssueEvent`
1500 """
1501 return github.PaginatedList.PaginatedList(
1502 github.IssueEvent.IssueEvent,
1503 self._requester,
1504 self.url + "/issues/events",
1505 None
1506 )
1507
1508 def get_key(self, id):
1509 """
1510 :calls: `GET /repos/:owner/:repo/keys/:id <http://developer.github.com/v3/repos/keys>`_
1511 :param id: integer
1512 :rtype: :class:`github.RepositoryKey.RepositoryKey`
1513 """
1514 assert isinstance(id, (int, long)), id
1515 headers, data = self._requester.requestJsonAndCheck(
1516 "GET",
1517 self.url + "/keys/" + str(id)
1518 )
1519 return github.RepositoryKey.RepositoryKey(self._requester, headers, data, completed=True, repoUrl=self.url)
1520
1521 def get_keys(self):
1522 """
1523 :calls: `GET /repos/:owner/:repo/keys <http://developer.github.com/v3/repos/keys>`_
1524 :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.RepositoryKey.RepositoryKey`
1525 """
1526 return github.PaginatedList.PaginatedList(
1527 lambda requester, headers, data, completed: github.RepositoryKey.RepositoryKey(requester, headers, data, completed, repoUrl=self.url),
1528 self._requester,
1529 self.url + "/keys",
1530 None
1531 )
1532
1533 def get_label(self, name):
1534 """
1535 :calls: `GET /repos/:owner/:repo/labels/:name <http://developer.github.com/v3/issues/labels>`_
1536 :param name: string
1537 :rtype: :class:`github.Label.Label`
1538 """
1539 assert isinstance(name, (str, unicode)), name
1540 headers, data = self._requester.requestJsonAndCheck(
1541 "GET",
1542 self.url + "/labels/" + urllib.quote(name)
1543 )
1544 return github.Label.Label(self._requester, headers, data, completed=True)
1545
1546 def get_labels(self):
1547 """
1548 :calls: `GET /repos/:owner/:repo/labels <http://developer.github.com/v3/issues/labels>`_
1549 :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Label.Label`
1550 """
1551 return github.PaginatedList.PaginatedList(
1552 github.Label.Label,
1553 self._requester,
1554 self.url + "/labels",
1555 None
1556 )
1557
1558 def get_languages(self):
1559 """
1560 :calls: `GET /repos/:owner/:repo/languages <http://developer.github.com/v3/repos>`_
1561 :rtype: dict of string to integer
1562 """
1563 headers, data = self._requester.requestJsonAndCheck(
1564 "GET",
1565 self.url + "/languages"
1566 )
1567 return data
1568
1569 def get_milestone(self, number):
1570 """
1571 :calls: `GET /repos/:owner/:repo/milestones/:number <http://developer.github.com/v3/issues/milestones>`_
1572 :param number: integer
1573 :rtype: :class:`github.Milestone.Milestone`
1574 """
1575 assert isinstance(number, (int, long)), number
1576 headers, data = self._requester.requestJsonAndCheck(
1577 "GET",
1578 self.url + "/milestones/" + str(number)
1579 )
1580 return github.Milestone.Milestone(self._requester, headers, data, completed=True)
1581
1582 def get_milestones(self, state=github.GithubObject.NotSet, sort=github.GithubObject.NotSet, direction=github.GithubObject.NotSet):
1583 """
1584 :calls: `GET /repos/:owner/:repo/milestones <http://developer.github.com/v3/issues/milestones>`_
1585 :param state: string
1586 :param sort: string
1587 :param direction: string
1588 :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Milestone.Milestone`
1589 """
1590 assert state is github.GithubObject.NotSet or isinstance(state, (str, unicode)), state
1591 assert sort is github.GithubObject.NotSet or isinstance(sort, (str, unicode)), sort
1592 assert direction is github.GithubObject.NotSet or isinstance(direction, (str, unicode)), direction
1593 url_parameters = dict()
1594 if state is not github.GithubObject.NotSet:
1595 url_parameters["state"] = state
1596 if sort is not github.GithubObject.NotSet:
1597 url_parameters["sort"] = sort
1598 if direction is not github.GithubObject.NotSet:
1599 url_parameters["direction"] = direction
1600 return github.PaginatedList.PaginatedList(
1601 github.Milestone.Milestone,
1602 self._requester,
1603 self.url + "/milestones",
1604 url_parameters
1605 )
1606
1607 def get_network_events(self):
1608 """
1609 :calls: `GET /networks/:owner/:repo/events <http://developer.github.com/v3/activity/events>`_
1610 :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Event.Event`
1611 """
1612 return github.PaginatedList.PaginatedList(
1613 github.Event.Event,
1614 self._requester,
1615 "/networks/" + self.owner.login + "/" + self.name + "/events",
1616 None
1617 )
1618
1619 def get_pull(self, number):
1620 """
1621 :calls: `GET /repos/:owner/:repo/pulls/:number <http://developer.github.com/v3/pulls>`_
1622 :param number: integer
1623 :rtype: :class:`github.PullRequest.PullRequest`
1624 """
1625 assert isinstance(number, (int, long)), number
1626 headers, data = self._requester.requestJsonAndCheck(
1627 "GET",
1628 self.url + "/pulls/" + str(number)
1629 )
1630 return github.PullRequest.PullRequest(self._requester, headers, data, completed=True)
1631
1632 def get_pulls(self, state=github.GithubObject.NotSet):
1633 """
1634 :calls: `GET /repos/:owner/:repo/pulls <http://developer.github.com/v3/pulls>`_
1635 :param state: string
1636 :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.PullRequest.PullRequest`
1637 """
1638 assert state is github.GithubObject.NotSet or isinstance(state, (str, unicode)), state
1639 url_parameters = dict()
1640 if state is not github.GithubObject.NotSet:
1641 url_parameters["state"] = state
1642 return github.PaginatedList.PaginatedList(
1643 github.PullRequest.PullRequest,
1644 self._requester,
1645 self.url + "/pulls",
1646 url_parameters
1647 )
1648
1649 def get_pulls_comments(self, sort=github.GithubObject.NotSet, direction=github.GithubObject.NotSet, since=github.GithubObject.NotSet):
1650 """
1651 :calls: `GET /repos/:owner/:repo/pulls/comments <http://developer.github.com/v3/pulls/comments>`_
1652 :param sort: string
1653 :param direction: string
1654 :param since: datetime.datetime
1655 :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.PullRequestComment.PullRequestComment`
1656 """
1657 return self.get_pulls_review_comments(sort, direction, since)
1658
1659 def get_pulls_review_comments(self, sort=github.GithubObject.NotSet, direction=github.GithubObject.NotSet, since=github.GithubObject.NotSet):
1660 """
1661 :calls: `GET /repos/:owner/:repo/pulls/comments <http://developer.github.com/v3/pulls/comments>`_
1662 :param sort: string
1663 :param direction: string
1664 :param since: datetime.datetime
1665 :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.PullRequestComment.PullRequestComment`
1666 """
1667 assert sort is github.GithubObject.NotSet or isinstance(sort, (str, unicode)), sort
1668 assert direction is github.GithubObject.NotSet or isinstance(direction, (str, unicode)), direction
1669 assert since is github.GithubObject.NotSet or isinstance(since, datetime.datetime), since
1670 url_parameters = dict()
1671 if sort is not github.GithubObject.NotSet:
1672 url_parameters["sort"] = sort
1673 if direction is not github.GithubObject.NotSet:
1674 url_parameters["direction"] = direction
1675 if since is not github.GithubObject.NotSet:
1676 url_parameters["since"] = since.strftime("%Y-%m-%dT%H:%M:%SZ")
1677 return github.PaginatedList.PaginatedList(
1678 github.IssueComment.IssueComment,
1679 self._requester,
1680 self.url + "/pulls/comments",
1681 url_parameters
1682 )
1683
1684 def get_readme(self, ref=github.GithubObject.NotSet):
1685 """
1686 :calls: `GET /repos/:owner/:repo/readme <http://developer.github.com/v3/repos/contents>`_
1687 :param ref: string
1688 :rtype: :class:`github.ContentFile.ContentFile`
1689 """
1690 assert ref is github.GithubObject.NotSet or isinstance(ref, (str, unicode)), ref
1691 url_parameters = dict()
1692 if ref is not github.GithubObject.NotSet:
1693 url_parameters["ref"] = ref
1694 headers, data = self._requester.requestJsonAndCheck(
1695 "GET",
1696 self.url + "/readme",
1697 parameters=url_parameters
1698 )
1699 return github.ContentFile.ContentFile(self._requester, headers, data, completed=True)
1700
1701 def get_stargazers(self):
1702 """
1703 :calls: `GET /repos/:owner/:repo/stargazers <http://developer.github.com/v3/activity/starring>`_
1704 :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.NamedUser.NamedUser`
1705 """
1706 return github.PaginatedList.PaginatedList(
1707 github.NamedUser.NamedUser,
1708 self._requester,
1709 self.url + "/stargazers",
1710 None
1711 )
1712
1713 def get_stats_contributors(self):
1714 """
1715 :calls: `GET /repos/:owner/:repo/stats/contributors <http://developer.github.com/v3/repos/statistics/#get-contributors-list-with-additions-deletions-and-commit-counts>`_
1716 :rtype: None or list of :class:`github.StatsContributor.StatsContributor`
1717 """
1718 headers, data = self._requester.requestJsonAndCheck(
1719 "GET",
1720 self.url + "/stats/contributors"
1721 )
1722 if data == {}:
1723 return None
1724 else:
1725 return [
1726 github.StatsContributor.StatsContributor(self._requester, headers, attributes, completed=True)
1727 for attributes in data
1728 ]
1729
1730 def get_stats_commit_activity(self):
1731 """
1732 :calls: `GET /repos/:owner/:repo/stats/commit_activity <developer.github.com/v3/repos/statistics/#get-the-number-of-commits-per-hour-in-each-day>`_
1733 :rtype: None or list of :class:`github.StatsCommitActivity.StatsCommitActivity`
1734 """
1735 headers, data = self._requester.requestJsonAndCheck(
1736 "GET",
1737 self.url + "/stats/commit_activity"
1738 )
1739 if data == {}:
1740 return None
1741 else:
1742 return [
1743 github.StatsCommitActivity.StatsCommitActivity(self._requester, headers, attributes, completed=True)
1744 for attributes in data
1745 ]
1746
1747 def get_stats_code_frequency(self):
1748 """
1749 :calls: `GET /repos/:owner/:repo/stats/code_frequency <http://developer.github.com/v3/repos/statistics/#get-the-number-of-additions-and-deletions-per-week>`_
1750 :rtype: None or list of :class:`github.StatsCodeFrequency.StatsCodeFrequency`
1751 """
1752 headers, data = self._requester.requestJsonAndCheck(
1753 "GET",
1754 self.url + "/stats/code_frequency"
1755 )
1756 if data == {}:
1757 return None
1758 else:
1759 return [
1760 github.StatsCodeFrequency.StatsCodeFrequency(self._requester, headers, attributes, completed=True)
1761 for attributes in data
1762 ]
1763
1764 def get_stats_participation(self):
1765 """
1766 :calls: `GET /repos/:owner/:repo/stats/participation <http://developer.github.com/v3/repos/statistics/#get-the-weekly-commit-count-for-the-repo-owner-and-everyone-else>`_
1767 :rtype: None or :class:`github.StatsParticipation.StatsParticipation`
1768 """
1769 headers, data = self._requester.requestJsonAndCheck(
1770 "GET",
1771 self.url + "/stats/participation"
1772 )
1773 if data == {}:
1774 return None
1775 else:
1776 return github.StatsParticipation.StatsParticipation(self._requester, headers, data, completed=True)
1777
1778 def get_stats_punch_card(self):
1779 """
1780 :calls: `GET /repos/:owner/:repo/stats/punch_card <http://developer.github.com/v3/repos/statistics/#get-the-number-of-commits-per-hour-in-each-day>`_
1781 :rtype: None or :class:`github.StatsPunchCard.StatsPunchCard`
1782 """
1783 headers, data = self._requester.requestJsonAndCheck(
1784 "GET",
1785 self.url + "/stats/punch_card"
1786 )
1787 if data == {}:
1788 return None
1789 else:
1790 return github.StatsPunchCard.StatsPunchCard(self._requester, headers, data, completed=True)
1791
1792 def get_subscribers(self):
1793 """
1794 :calls: `GET /repos/:owner/:repo/subscribers <http://developer.github.com/v3/activity/watching>`_
1795 :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.NamedUser.NamedUser`
1796 """
1797 return github.PaginatedList.PaginatedList(
1798 github.NamedUser.NamedUser,
1799 self._requester,
1800 self.url + "/subscribers",
1801 None
1802 )
1803
1804 def get_tags(self):
1805 """
1806 :calls: `GET /repos/:owner/:repo/tags <http://developer.github.com/v3/repos>`_
1807 :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Tag.Tag`
1808 """
1809 return github.PaginatedList.PaginatedList(
1810 github.Tag.Tag,
1811 self._requester,
1812 self.url + "/tags",
1813 None
1814 )
1815
1816 def get_teams(self):
1817 """
1818 :calls: `GET /repos/:owner/:repo/teams <http://developer.github.com/v3/repos>`_
1819 :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Team.Team`
1820 """
1821 return github.PaginatedList.PaginatedList(
1822 github.Team.Team,
1823 self._requester,
1824 self.url + "/teams",
1825 None
1826 )
1827
1828 def get_watchers(self):
1829 """
1830 :calls: `GET /repos/:owner/:repo/watchers <http://developer.github.com/v3/activity/starring>`_
1831 :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.NamedUser.NamedUser`
1832 """
1833 return github.PaginatedList.PaginatedList(
1834 github.NamedUser.NamedUser,
1835 self._requester,
1836 self.url + "/watchers",
1837 None
1838 )
1839
1840 def has_in_assignees(self, assignee):
1841 """
1842 :calls: `GET /repos/:owner/:repo/assignees/:assignee <http://developer.github.com/v3/issues/assignees>`_
1843 :param assignee: string or :class:`github.NamedUser.NamedUser`
1844 :rtype: bool
1845 """
1846 assert isinstance(assignee, github.NamedUser.NamedUser) or isinstance(assignee, (str, unicode)), assignee
1847
1848 if isinstance(assignee, github.NamedUser.NamedUser):
1849 assignee = assignee._identity
1850
1851 status, headers, data = self._requester.requestJson(
1852 "GET",
1853 self.url + "/assignees/" + assignee
1854 )
1855 return status == 204
1856
1857 def has_in_collaborators(self, collaborator):
1858 """
1859 :calls: `GET /repos/:owner/:repo/collaborators/:user <http://developer.github.com/v3/repos/collaborators>`_
1860 :param collaborator: string or :class:`github.NamedUser.NamedUser`
1861 :rtype: bool
1862 """
1863 assert isinstance(collaborator, github.NamedUser.NamedUser) or isinstance(collaborator, (str, unicode)), collaborator
1864
1865 if isinstance(collaborator, github.NamedUser.NamedUser):
1866 collaborator = collaborator._identity
1867
1868 status, headers, data = self._requester.requestJson(
1869 "GET",
1870 self.url + "/collaborators/" + collaborator
1871 )
1872 return status == 204
1873
1874 def legacy_search_issues(self, state, keyword):
1875 """
1876 :calls: `GET /legacy/issues/search/:owner/:repository/:state/:keyword <http://developer.github.com/v3/search/legacy>`_
1877 :param state: "open" or "closed"
1878 :param keyword: string
1879 :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Issue.Issue`
1880 """
1881 assert state in ["open", "closed"], state
1882 assert isinstance(keyword, (str, unicode)), keyword
1883 headers, data = self._requester.requestJsonAndCheck(
1884 "GET",
1885 "/legacy/issues/search/" + self.owner.login + "/" + self.name + "/" + state + "/" + urllib.quote(keyword)
1886 )
1887 return [
1888 github.Issue.Issue(self._requester, headers, github.Legacy.convertIssue(element), completed=False)
1889 for element in data["issues"]
1890 ]
1891
1892 def merge(self, base, head, commit_message=github.GithubObject.NotSet):
1893 """
1894 :calls: `POST /repos/:owner/:repo/merges <http://developer.github.com/v3/repos/merging>`_
1895 :param base: string
1896 :param head: string
1897 :param commit_message: string
1898 :rtype: :class:`github.Commit.Commit`
1899 """
1900 assert isinstance(base, (str, unicode)), base
1901 assert isinstance(head, (str, unicode)), head
1902 assert commit_message is github.GithubObject.NotSet or isinstance(commit_message, (str, unicode)), commit_message
1903 post_parameters = {
1904 "base": base,
1905 "head": head,
1906 }
1907 if commit_message is not github.GithubObject.NotSet:
1908 post_parameters["commit_message"] = commit_message
1909 headers, data = self._requester.requestJsonAndCheck(
1910 "POST",
1911 self.url + "/merges",
1912 input=post_parameters
1913 )
1914 if data is None:
1915 return None
1916 else:
1917 return github.Commit.Commit(self._requester, headers, data, completed=True)
1918
1919 def remove_from_collaborators(self, collaborator):
1920 """
1921 :calls: `DELETE /repos/:owner/:repo/collaborators/:user <http://developer.github.com/v3/repos/collaborators>`_
1922 :param collaborator: string or :class:`github.NamedUser.NamedUser`
1923 :rtype: None
1924 """
1925 assert isinstance(collaborator, github.NamedUser.NamedUser) or isinstance(collaborator, (str, unicode)), collaborator
1926
1927 if isinstance(collaborator, github.NamedUser.NamedUser):
1928 collaborator = collaborator._identity
1929
1930 headers, data = self._requester.requestJsonAndCheck(
1931 "DELETE",
1932 self.url + "/collaborators/" + collaborator
1933 )
1934
1935 def subscribe_to_hub(self, event, callback, secret=github.GithubObject.NotSet):
1936 """
1937 :calls: `POST /hub <http://developer.github.com/>`_
1938 :param event: string
1939 :param callback: string
1940 :param secret: string
1941 :rtype: None
1942 """
1943 return self._hub("subscribe", event, callback, secret)
1944
1945 def unsubscribe_from_hub(self, event, callback):
1946 """
1947 :calls: `POST /hub <http://developer.github.com/>`_
1948 :param event: string
1949 :param callback: string
1950 :param secret: string
1951 :rtype: None
1952 """
1953 return self._hub("unsubscribe", event, callback, github.GithubObject.NotSet)
1954
1955 def _hub(self, mode, event, callback, secret):
1956 assert isinstance(mode, (str, unicode)), mode
1957 assert isinstance(event, (str, unicode)), event
1958 assert isinstance(callback, (str, unicode)), callback
1959 assert secret is github.GithubObject.NotSet or isinstance(secret, (str, unicode)), secret
1960
1961 post_parameters = {
1962 "hub.mode": mode,
1963 "hub.topic": "https://github.com/" + self.full_name + "/events/" + event,
1964 "hub.callback": callback,
1965 }
1966 if secret is not github.GithubObject.NotSet:
1967 post_parameters["hub.secret"] = secret
1968
1969 headers, output = self._requester.requestMultipartAndCheck(
1970 "POST",
1971 "/hub",
1972 input=post_parameters
1973 )
1974
1975 @property
1976 def _identity(self):
1977 return self.owner.login + "/" + self.name
1978
1979 def _initAttributes(self):
1980 self._archive_url = github.GithubObject.NotSet
1981 self._assignees_url = github.GithubObject.NotSet
1982 self._blobs_url = github.GithubObject.NotSet
1983 self._branches_url = github.GithubObject.NotSet
1984 self._clone_url = github.GithubObject.NotSet
1985 self._collaborators_url = github.GithubObject.NotSet
1986 self._comments_url = github.GithubObject.NotSet
1987 self._commits_url = github.GithubObject.NotSet
1988 self._compare_url = github.GithubObject.NotSet
1989 self._contents_url = github.GithubObject.NotSet
1990 self._contributors_url = github.GithubObject.NotSet
1991 self._created_at = github.GithubObject.NotSet
1992 self._default_branch = github.GithubObject.NotSet
1993 self._description = github.GithubObject.NotSet
1994 self._downloads_url = github.GithubObject.NotSet
1995 self._events_url = github.GithubObject.NotSet
1996 self._fork = github.GithubObject.NotSet
1997 self._forks = github.GithubObject.NotSet
1998 self._forks_count = github.GithubObject.NotSet
1999 self._forks_url = github.GithubObject.NotSet
2000 self._full_name = github.GithubObject.NotSet
2001 self._git_commits_url = github.GithubObject.NotSet
2002 self._git_refs_url = github.GithubObject.NotSet
2003 self._git_tags_url = github.GithubObject.NotSet
2004 self._git_url = github.GithubObject.NotSet
2005 self._has_downloads = github.GithubObject.NotSet
2006 self._has_issues = github.GithubObject.NotSet
2007 self._has_wiki = github.GithubObject.NotSet
2008 self._homepage = github.GithubObject.NotSet
2009 self._hooks_url = github.GithubObject.NotSet
2010 self._html_url = github.GithubObject.NotSet
2011 self._id = github.GithubObject.NotSet
2012 self._issue_comment_url = github.GithubObject.NotSet
2013 self._issue_events_url = github.GithubObject.NotSet
2014 self._issues_url = github.GithubObject.NotSet
2015 self._keys_url = github.GithubObject.NotSet
2016 self._labels_url = github.GithubObject.NotSet
2017 self._language = github.GithubObject.NotSet
2018 self._languages_url = github.GithubObject.NotSet
2019 self._master_branch = github.GithubObject.NotSet
2020 self._merges_url = github.GithubObject.NotSet
2021 self._milestones_url = github.GithubObject.NotSet
2022 self._mirror_url = github.GithubObject.NotSet
2023 self._name = github.GithubObject.NotSet
2024 self._network_count = github.GithubObject.NotSet
2025 self._notifications_url = github.GithubObject.NotSet
2026 self._open_issues = github.GithubObject.NotSet
2027 self._open_issues_count = github.GithubObject.NotSet
2028 self._organization = github.GithubObject.NotSet
2029 self._owner = github.GithubObject.NotSet
2030 self._parent = github.GithubObject.NotSet
2031 self._permissions = github.GithubObject.NotSet
2032 self._private = github.GithubObject.NotSet
2033 self._pulls_url = github.GithubObject.NotSet
2034 self._pushed_at = github.GithubObject.NotSet
2035 self._size = github.GithubObject.NotSet
2036 self._source = github.GithubObject.NotSet
2037 self._ssh_url = github.GithubObject.NotSet
2038 self._stargazers_count = github.GithubObject.NotSet
2039 self._stargazers_url = github.GithubObject.NotSet
2040 self._statuses_url = github.GithubObject.NotSet
2041 self._subscribers_url = github.GithubObject.NotSet
2042 self._subscription_url = github.GithubObject.NotSet
2043 self._svn_url = github.GithubObject.NotSet
2044 self._tags_url = github.GithubObject.NotSet
2045 self._teams_url = github.GithubObject.NotSet
2046 self._trees_url = github.GithubObject.NotSet
2047 self._updated_at = github.GithubObject.NotSet
2048 self._url = github.GithubObject.NotSet
2049 self._watchers = github.GithubObject.NotSet
2050 self._watchers_count = github.GithubObject.NotSet
2051
2052 def _useAttributes(self, attributes):
2053 if "archive_url" in attributes: # pragma no branch
2054 self._archive_url = self._makeStringAttribute(attributes["archive_url"])
2055 if "assignees_url" in attributes: # pragma no branch
2056 self._assignees_url = self._makeStringAttribute(attributes["assignees_url"])
2057 if "blobs_url" in attributes: # pragma no branch
2058 self._blobs_url = self._makeStringAttribute(attributes["blobs_url"])
2059 if "branches_url" in attributes: # pragma no branch
2060 self._branches_url = self._makeStringAttribute(attributes["branches_url"])
2061 if "clone_url" in attributes: # pragma no branch
2062 self._clone_url = self._makeStringAttribute(attributes["clone_url"])
2063 if "collaborators_url" in attributes: # pragma no branch
2064 self._collaborators_url = self._makeStringAttribute(attributes["collaborators_url"])
2065 if "comments_url" in attributes: # pragma no branch
2066 self._comments_url = self._makeStringAttribute(attributes["comments_url"])
2067 if "commits_url" in attributes: # pragma no branch
2068 self._commits_url = self._makeStringAttribute(attributes["commits_url"])
2069 if "compare_url" in attributes: # pragma no branch
2070 self._compare_url = self._makeStringAttribute(attributes["compare_url"])
2071 if "contents_url" in attributes: # pragma no branch
2072 self._contents_url = self._makeStringAttribute(attributes["contents_url"])
2073 if "contributors_url" in attributes: # pragma no branch
2074 self._contributors_url = self._makeStringAttribute(attributes["contributors_url"])
2075 if "created_at" in attributes: # pragma no branch
2076 self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
2077 if "default_branch" in attributes: # pragma no branch
2078 self._default_branch = self._makeStringAttribute(attributes["default_branch"])
2079 if "description" in attributes: # pragma no branch
2080 self._description = self._makeStringAttribute(attributes["description"])
2081 if "downloads_url" in attributes: # pragma no branch
2082 self._downloads_url = self._makeStringAttribute(attributes["downloads_url"])
2083 if "events_url" in attributes: # pragma no branch
2084 self._events_url = self._makeStringAttribute(attributes["events_url"])
2085 if "fork" in attributes: # pragma no branch
2086 self._fork = self._makeBoolAttribute(attributes["fork"])
2087 if "forks" in attributes: # pragma no branch
2088 self._forks = self._makeIntAttribute(attributes["forks"])
2089 if "forks_count" in attributes: # pragma no branch
2090 self._forks_count = self._makeIntAttribute(attributes["forks_count"])
2091 if "forks_url" in attributes: # pragma no branch
2092 self._forks_url = self._makeStringAttribute(attributes["forks_url"])
2093 if "full_name" in attributes: # pragma no branch
2094 self._full_name = self._makeStringAttribute(attributes["full_name"])
2095 if "git_commits_url" in attributes: # pragma no branch
2096 self._git_commits_url = self._makeStringAttribute(attributes["git_commits_url"])
2097 if "git_refs_url" in attributes: # pragma no branch
2098 self._git_refs_url = self._makeStringAttribute(attributes["git_refs_url"])
2099 if "git_tags_url" in attributes: # pragma no branch
2100 self._git_tags_url = self._makeStringAttribute(attributes["git_tags_url"])
2101 if "git_url" in attributes: # pragma no branch
2102 self._git_url = self._makeStringAttribute(attributes["git_url"])
2103 if "has_downloads" in attributes: # pragma no branch
2104 self._has_downloads = self._makeBoolAttribute(attributes["has_downloads"])
2105 if "has_issues" in attributes: # pragma no branch
2106 self._has_issues = self._makeBoolAttribute(attributes["has_issues"])
2107 if "has_wiki" in attributes: # pragma no branch
2108 self._has_wiki = self._makeBoolAttribute(attributes["has_wiki"])
2109 if "homepage" in attributes: # pragma no branch
2110 self._homepage = self._makeStringAttribute(attributes["homepage"])
2111 if "hooks_url" in attributes: # pragma no branch
2112 self._hooks_url = self._makeStringAttribute(attributes["hooks_url"])
2113 if "html_url" in attributes: # pragma no branch
2114 self._html_url = self._makeStringAttribute(attributes["html_url"])
2115 if "id" in attributes: # pragma no branch
2116 self._id = self._makeIntAttribute(attributes["id"])
2117 if "issue_comment_url" in attributes: # pragma no branch
2118 self._issue_comment_url = self._makeStringAttribute(attributes["issue_comment_url"])
2119 if "issue_events_url" in attributes: # pragma no branch
2120 self._issue_events_url = self._makeStringAttribute(attributes["issue_events_url"])
2121 if "issues_url" in attributes: # pragma no branch
2122 self._issues_url = self._makeStringAttribute(attributes["issues_url"])
2123 if "keys_url" in attributes: # pragma no branch
2124 self._keys_url = self._makeStringAttribute(attributes["keys_url"])
2125 if "labels_url" in attributes: # pragma no branch
2126 self._labels_url = self._makeStringAttribute(attributes["labels_url"])
2127 if "language" in attributes: # pragma no branch
2128 self._language = self._makeStringAttribute(attributes["language"])
2129 if "languages_url" in attributes: # pragma no branch
2130 self._languages_url = self._makeStringAttribute(attributes["languages_url"])
2131 if "master_branch" in attributes: # pragma no branch
2132 self._master_branch = self._makeStringAttribute(attributes["master_branch"])
2133 if "merges_url" in attributes: # pragma no branch
2134 self._merges_url = self._makeStringAttribute(attributes["merges_url"])
2135 if "milestones_url" in attributes: # pragma no branch
2136 self._milestones_url = self._makeStringAttribute(attributes["milestones_url"])
2137 if "mirror_url" in attributes: # pragma no branch
2138 self._mirror_url = self._makeStringAttribute(attributes["mirror_url"])
2139 if "name" in attributes: # pragma no branch
2140 self._name = self._makeStringAttribute(attributes["name"])
2141 if "network_count" in attributes: # pragma no branch
2142 self._network_count = self._makeIntAttribute(attributes["network_count"])
2143 if "notifications_url" in attributes: # pragma no branch
2144 self._notifications_url = self._makeStringAttribute(attributes["notifications_url"])
2145 if "open_issues" in attributes: # pragma no branch
2146 self._open_issues = self._makeIntAttribute(attributes["open_issues"])
2147 if "open_issues_count" in attributes: # pragma no branch
2148 self._open_issues_count = self._makeIntAttribute(attributes["open_issues_count"])
2149 if "organization" in attributes: # pragma no branch
2150 self._organization = self._makeClassAttribute(github.Organization.Organization, attributes["organization"])
2151 if "owner" in attributes: # pragma no branch
2152 self._owner = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["owner"])
2153 if "parent" in attributes: # pragma no branch
2154 self._parent = self._makeClassAttribute(Repository, attributes["parent"])
2155 if "permissions" in attributes: # pragma no branch
2156 self._permissions = self._makeClassAttribute(github.Permissions.Permissions, attributes["permissions"])
2157 if "private" in attributes: # pragma no branch
2158 self._private = self._makeBoolAttribute(attributes["private"])
2159 if "pulls_url" in attributes: # pragma no branch
2160 self._pulls_url = self._makeStringAttribute(attributes["pulls_url"])
2161 if "pushed_at" in attributes: # pragma no branch
2162 self._pushed_at = self._makeDatetimeAttribute(attributes["pushed_at"])
2163 if "size" in attributes: # pragma no branch
2164 self._size = self._makeIntAttribute(attributes["size"])
2165 if "source" in attributes: # pragma no branch
2166 self._source = self._makeClassAttribute(Repository, attributes["source"])
2167 if "ssh_url" in attributes: # pragma no branch
2168 self._ssh_url = self._makeStringAttribute(attributes["ssh_url"])
2169 if "stargazers_count" in attributes: # pragma no branch
2170 self._stargazers_count = self._makeIntAttribute(attributes["stargazers_count"])
2171 if "stargazers_url" in attributes: # pragma no branch
2172 self._stargazers_url = self._makeStringAttribute(attributes["stargazers_url"])
2173 if "statuses_url" in attributes: # pragma no branch
2174 self._statuses_url = self._makeStringAttribute(attributes["statuses_url"])
2175 if "subscribers_url" in attributes: # pragma no branch
2176 self._subscribers_url = self._makeStringAttribute(attributes["subscribers_url"])
2177 if "subscription_url" in attributes: # pragma no branch
2178 self._subscription_url = self._makeStringAttribute(attributes["subscription_url"])
2179 if "svn_url" in attributes: # pragma no branch
2180 self._svn_url = self._makeStringAttribute(attributes["svn_url"])
2181 if "tags_url" in attributes: # pragma no branch
2182 self._tags_url = self._makeStringAttribute(attributes["tags_url"])
2183 if "teams_url" in attributes: # pragma no branch
2184 self._teams_url = self._makeStringAttribute(attributes["teams_url"])
2185 if "trees_url" in attributes: # pragma no branch
2186 self._trees_url = self._makeStringAttribute(attributes["trees_url"])
2187 if "updated_at" in attributes: # pragma no branch
2188 self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
2189 if "url" in attributes: # pragma no branch
2190 self._url = self._makeStringAttribute(attributes["url"])
2191 if "watchers" in attributes: # pragma no branch
2192 self._watchers = self._makeIntAttribute(attributes["watchers"])
2193 if "watchers_count" in attributes: # pragma no branch
2194 self._watchers_count = self._makeIntAttribute(attributes["watchers_count"])