mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-02 03:41:08 +00:00
Merge branch 'topic/RememberHeaders' into develop (#192)
Conflicts: github/Issue.py github/MainClass.py github/PaginatedList.py github/Repository.py github/Requester.py
This commit is contained in:
+11
-10
@@ -5,6 +5,7 @@
|
||||
# Copyright 2012 Steve English <steve.english@navetas.com> #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
@@ -348,7 +349,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return github.Authorization.Authorization(self._requester, data, completed=True)
|
||||
return github.Authorization.Authorization(self._requester, headers, data, completed=True)
|
||||
|
||||
def create_fork(self, repo):
|
||||
"""
|
||||
@@ -363,7 +364,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return github.Repository.Repository(self._requester, data, completed=True)
|
||||
return github.Repository.Repository(self._requester, headers, data, completed=True)
|
||||
|
||||
def create_gist(self, public, files, description=github.GithubObject.NotSet):
|
||||
"""
|
||||
@@ -388,7 +389,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return github.Gist.Gist(self._requester, data, completed=True)
|
||||
return github.Gist.Gist(self._requester, headers, data, completed=True)
|
||||
|
||||
def create_key(self, title, key):
|
||||
"""
|
||||
@@ -409,7 +410,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return github.UserKey.UserKey(self._requester, data, completed=True)
|
||||
return github.UserKey.UserKey(self._requester, headers, data, completed=True)
|
||||
|
||||
def create_repo(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, auto_init=github.GithubObject.NotSet, gitignore_template=github.GithubObject.NotSet):
|
||||
"""
|
||||
@@ -459,7 +460,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return github.Repository.Repository(self._requester, data, completed=True)
|
||||
return github.Repository.Repository(self._requester, headers, data, completed=True)
|
||||
|
||||
def edit(self, name=github.GithubObject.NotSet, email=github.GithubObject.NotSet, blog=github.GithubObject.NotSet, company=github.GithubObject.NotSet, location=github.GithubObject.NotSet, hireable=github.GithubObject.NotSet, bio=github.GithubObject.NotSet):
|
||||
"""
|
||||
@@ -516,7 +517,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return github.Authorization.Authorization(self._requester, data, completed=True)
|
||||
return github.Authorization.Authorization(self._requester, headers, data, completed=True)
|
||||
|
||||
def get_authorizations(self):
|
||||
"""
|
||||
@@ -680,7 +681,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return github.UserKey.UserKey(self._requester, data, completed=True)
|
||||
return github.UserKey.UserKey(self._requester, headers, data, completed=True)
|
||||
|
||||
def get_keys(self):
|
||||
"""
|
||||
@@ -707,7 +708,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return github.Notification.Notification(self._requester, data, completed=True)
|
||||
return github.Notification.Notification(self._requester, headers, data, completed=True)
|
||||
|
||||
def get_notifications(self, all=github.GithubObject.NotSet, participating=github.GithubObject.NotSet):
|
||||
"""
|
||||
@@ -771,7 +772,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return github.Repository.Repository(self._requester, data, completed=True)
|
||||
return github.Repository.Repository(self._requester, headers, data, completed=True)
|
||||
|
||||
def get_repos(self, type=github.GithubObject.NotSet, sort=github.GithubObject.NotSet, direction=github.GithubObject.NotSet):
|
||||
"""
|
||||
@@ -1061,7 +1062,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject):
|
||||
self._owned_private_repos = attributes["owned_private_repos"]
|
||||
if "plan" in attributes: # pragma no branch
|
||||
assert attributes["plan"] is None or isinstance(attributes["plan"], dict), attributes["plan"]
|
||||
self._plan = None if attributes["plan"] is None else github.Plan.Plan(self._requester, attributes["plan"], completed=False)
|
||||
self._plan = None if attributes["plan"] is None else github.Plan.Plan(self._requester, self._headers, attributes["plan"], completed=False)
|
||||
if "private_gists" in attributes: # pragma no branch
|
||||
assert attributes["private_gists"] is None or isinstance(attributes["private_gists"], (int, long)), attributes["private_gists"]
|
||||
self._private_gists = attributes["private_gists"]
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
@@ -165,7 +166,7 @@ class Authorization(github.GithubObject.CompletableGithubObject):
|
||||
def _useAttributes(self, attributes):
|
||||
if "app" in attributes: # pragma no branch
|
||||
assert attributes["app"] is None or isinstance(attributes["app"], dict), attributes["app"]
|
||||
self._app = None if attributes["app"] is None else github.AuthorizationApplication.AuthorizationApplication(self._requester, attributes["app"], completed=False)
|
||||
self._app = None if attributes["app"] is None else github.AuthorizationApplication.AuthorizationApplication(self._requester, self._headers, attributes["app"], completed=False)
|
||||
if "created_at" in attributes: # pragma no branch
|
||||
assert attributes["created_at"] is None or isinstance(attributes["created_at"], (str, unicode)), attributes["created_at"]
|
||||
self._created_at = self._parseDatetime(attributes["created_at"])
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
|
||||
+2
-1
@@ -4,6 +4,7 @@
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2013 martinqt <m.ki2@laposte.net> #
|
||||
# #
|
||||
@@ -55,7 +56,7 @@ class Branch(github.GithubObject.NonCompletableGithubObject):
|
||||
def _useAttributes(self, attributes):
|
||||
if "commit" in attributes: # pragma no branch
|
||||
assert attributes["commit"] is None or isinstance(attributes["commit"], dict), attributes["commit"]
|
||||
self._commit = None if attributes["commit"] is None else github.Commit.Commit(self._requester, attributes["commit"], completed=False)
|
||||
self._commit = None if attributes["commit"] is None else github.Commit.Commit(self._requester, self._headers, attributes["commit"], completed=False)
|
||||
if "name" in attributes: # pragma no branch
|
||||
assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"]
|
||||
self._name = attributes["name"]
|
||||
|
||||
+9
-8
@@ -4,6 +4,7 @@
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2013 martinqt <m.ki2@laposte.net> #
|
||||
# #
|
||||
@@ -132,7 +133,7 @@ class Commit(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return github.CommitComment.CommitComment(self._requester, data, completed=True)
|
||||
return github.CommitComment.CommitComment(self._requester, headers, data, completed=True)
|
||||
|
||||
def create_status(self, state, target_url=github.GithubObject.NotSet, description=github.GithubObject.NotSet):
|
||||
"""
|
||||
@@ -158,7 +159,7 @@ class Commit(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return github.CommitStatus.CommitStatus(self._requester, data, completed=True)
|
||||
return github.CommitStatus.CommitStatus(self._requester, headers, data, completed=True)
|
||||
|
||||
def get_comments(self):
|
||||
"""
|
||||
@@ -201,23 +202,23 @@ class Commit(github.GithubObject.CompletableGithubObject):
|
||||
def _useAttributes(self, attributes):
|
||||
if "author" in attributes: # pragma no branch
|
||||
assert attributes["author"] is None or isinstance(attributes["author"], dict), attributes["author"]
|
||||
self._author = None if attributes["author"] is None else github.NamedUser.NamedUser(self._requester, attributes["author"], completed=False)
|
||||
self._author = None if attributes["author"] is None else github.NamedUser.NamedUser(self._requester, self._headers, attributes["author"], completed=False)
|
||||
if "commit" in attributes: # pragma no branch
|
||||
assert attributes["commit"] is None or isinstance(attributes["commit"], dict), attributes["commit"]
|
||||
self._commit = None if attributes["commit"] is None else github.GitCommit.GitCommit(self._requester, attributes["commit"], completed=False)
|
||||
self._commit = None if attributes["commit"] is None else github.GitCommit.GitCommit(self._requester, self._headers, attributes["commit"], completed=False)
|
||||
if "committer" in attributes: # pragma no branch
|
||||
assert attributes["committer"] is None or isinstance(attributes["committer"], dict), attributes["committer"]
|
||||
self._committer = None if attributes["committer"] is None else github.NamedUser.NamedUser(self._requester, attributes["committer"], completed=False)
|
||||
self._committer = None if attributes["committer"] is None else github.NamedUser.NamedUser(self._requester, self._headers, attributes["committer"], completed=False)
|
||||
if "files" in attributes: # pragma no branch
|
||||
assert attributes["files"] is None or all(isinstance(element, dict) for element in attributes["files"]), attributes["files"]
|
||||
self._files = None if attributes["files"] is None else [
|
||||
github.File.File(self._requester, element, completed=False)
|
||||
github.File.File(self._requester, self._headers, element, completed=False)
|
||||
for element in attributes["files"]
|
||||
]
|
||||
if "parents" in attributes: # pragma no branch
|
||||
assert attributes["parents"] is None or all(isinstance(element, dict) for element in attributes["parents"]), attributes["parents"]
|
||||
self._parents = None if attributes["parents"] is None else [
|
||||
Commit(self._requester, element, completed=False)
|
||||
Commit(self._requester, self._headers, element, completed=False)
|
||||
for element in attributes["parents"]
|
||||
]
|
||||
if "sha" in attributes: # pragma no branch
|
||||
@@ -225,7 +226,7 @@ class Commit(github.GithubObject.CompletableGithubObject):
|
||||
self._sha = attributes["sha"]
|
||||
if "stats" in attributes: # pragma no branch
|
||||
assert attributes["stats"] is None or isinstance(attributes["stats"], dict), attributes["stats"]
|
||||
self._stats = None if attributes["stats"] is None else github.CommitStats.CommitStats(self._requester, attributes["stats"], completed=False)
|
||||
self._stats = None if attributes["stats"] is None else github.CommitStats.CommitStats(self._requester, self._headers, attributes["stats"], completed=False)
|
||||
if "url" in attributes: # pragma no branch
|
||||
assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"]
|
||||
self._url = attributes["url"]
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
@@ -197,4 +198,4 @@ class CommitComment(github.GithubObject.CompletableGithubObject):
|
||||
self._url = attributes["url"]
|
||||
if "user" in attributes: # pragma no branch
|
||||
assert attributes["user"] is None or isinstance(attributes["user"], dict), attributes["user"]
|
||||
self._user = None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, attributes["user"], completed=False)
|
||||
self._user = None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, self._headers, attributes["user"], completed=False)
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
@@ -97,7 +98,7 @@ class CommitStatus(github.GithubObject.NonCompletableGithubObject):
|
||||
self._created_at = self._parseDatetime(attributes["created_at"])
|
||||
if "creator" in attributes: # pragma no branch
|
||||
assert attributes["creator"] is None or isinstance(attributes["creator"], dict), attributes["creator"]
|
||||
self._creator = None if attributes["creator"] is None else github.NamedUser.NamedUser(self._requester, attributes["creator"], completed=False)
|
||||
self._creator = None if attributes["creator"] is None else github.NamedUser.NamedUser(self._requester, self._headers, attributes["creator"], completed=False)
|
||||
if "description" in attributes: # pragma no branch
|
||||
assert attributes["description"] is None or isinstance(attributes["description"], (str, unicode)), attributes["description"]
|
||||
self._description = attributes["description"]
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
@@ -150,14 +151,14 @@ class Comparison(github.GithubObject.CompletableGithubObject):
|
||||
self._ahead_by = attributes["ahead_by"]
|
||||
if "base_commit" in attributes: # pragma no branch
|
||||
assert attributes["base_commit"] is None or isinstance(attributes["base_commit"], dict), attributes["base_commit"]
|
||||
self._base_commit = None if attributes["base_commit"] is None else github.Commit.Commit(self._requester, attributes["base_commit"], completed=False)
|
||||
self._base_commit = None if attributes["base_commit"] is None else github.Commit.Commit(self._requester, self._headers, attributes["base_commit"], completed=False)
|
||||
if "behind_by" in attributes: # pragma no branch
|
||||
assert attributes["behind_by"] is None or isinstance(attributes["behind_by"], (int, long)), attributes["behind_by"]
|
||||
self._behind_by = attributes["behind_by"]
|
||||
if "commits" in attributes: # pragma no branch
|
||||
assert attributes["commits"] is None or all(isinstance(element, dict) for element in attributes["commits"]), attributes["commits"]
|
||||
self._commits = None if attributes["commits"] is None else [
|
||||
github.Commit.Commit(self._requester, element, completed=False)
|
||||
github.Commit.Commit(self._requester, self._headers, element, completed=False)
|
||||
for element in attributes["commits"]
|
||||
]
|
||||
if "diff_url" in attributes: # pragma no branch
|
||||
@@ -166,7 +167,7 @@ class Comparison(github.GithubObject.CompletableGithubObject):
|
||||
if "files" in attributes: # pragma no branch
|
||||
assert attributes["files"] is None or all(isinstance(element, dict) for element in attributes["files"]), attributes["files"]
|
||||
self._files = None if attributes["files"] is None else [
|
||||
github.File.File(self._requester, element, completed=False)
|
||||
github.File.File(self._requester, self._headers, element, completed=False)
|
||||
for element in attributes["files"]
|
||||
]
|
||||
if "html_url" in attributes: # pragma no branch
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
|
||||
+4
-3
@@ -4,6 +4,7 @@
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2013 martinqt <m.ki2@laposte.net> #
|
||||
# #
|
||||
@@ -105,7 +106,7 @@ class Event(github.GithubObject.NonCompletableGithubObject):
|
||||
def _useAttributes(self, attributes):
|
||||
if "actor" in attributes: # pragma no branch
|
||||
assert attributes["actor"] is None or isinstance(attributes["actor"], dict), attributes["actor"]
|
||||
self._actor = None if attributes["actor"] is None else github.NamedUser.NamedUser(self._requester, attributes["actor"], completed=False)
|
||||
self._actor = None if attributes["actor"] is None else github.NamedUser.NamedUser(self._requester, self._headers, attributes["actor"], completed=False)
|
||||
if "created_at" in attributes: # pragma no branch
|
||||
assert attributes["created_at"] is None or isinstance(attributes["created_at"], (str, unicode)), attributes["created_at"]
|
||||
self._created_at = self._parseDatetime(attributes["created_at"])
|
||||
@@ -114,7 +115,7 @@ class Event(github.GithubObject.NonCompletableGithubObject):
|
||||
self._id = attributes["id"]
|
||||
if "org" in attributes: # pragma no branch
|
||||
assert attributes["org"] is None or isinstance(attributes["org"], dict), attributes["org"]
|
||||
self._org = None if attributes["org"] is None else github.Organization.Organization(self._requester, attributes["org"], completed=False)
|
||||
self._org = None if attributes["org"] is None else github.Organization.Organization(self._requester, self._headers, attributes["org"], completed=False)
|
||||
if "payload" in attributes: # pragma no branch
|
||||
assert attributes["payload"] is None or isinstance(attributes["payload"], dict), attributes["payload"]
|
||||
self._payload = attributes["payload"]
|
||||
@@ -123,7 +124,7 @@ class Event(github.GithubObject.NonCompletableGithubObject):
|
||||
self._public = attributes["public"]
|
||||
if "repo" in attributes: # pragma no branch
|
||||
assert attributes["repo"] is None or isinstance(attributes["repo"], dict), attributes["repo"]
|
||||
self._repo = None if attributes["repo"] is None else github.Repository.Repository(self._requester, attributes["repo"], completed=False)
|
||||
self._repo = None if attributes["repo"] is None else github.Repository.Repository(self._requester, self._headers, attributes["repo"], completed=False)
|
||||
if "type" in attributes: # pragma no branch
|
||||
assert attributes["type"] is None or isinstance(attributes["type"], (str, unicode)), attributes["type"]
|
||||
self._type = attributes["type"]
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
|
||||
+8
-7
@@ -5,6 +5,7 @@
|
||||
# Copyright 2012 Steve English <steve.english@navetas.com> #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
@@ -174,7 +175,7 @@ class Gist(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return github.GistComment.GistComment(self._requester, data, completed=True)
|
||||
return github.GistComment.GistComment(self._requester, headers, data, completed=True)
|
||||
|
||||
def create_fork(self):
|
||||
"""
|
||||
@@ -187,7 +188,7 @@ class Gist(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return Gist(self._requester, data, completed=True)
|
||||
return Gist(self._requester, headers, data, completed=True)
|
||||
|
||||
def delete(self):
|
||||
"""
|
||||
@@ -236,7 +237,7 @@ class Gist(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return github.GistComment.GistComment(self._requester, data, completed=True)
|
||||
return github.GistComment.GistComment(self._requester, headers, data, completed=True)
|
||||
|
||||
def get_comments(self):
|
||||
"""
|
||||
@@ -317,12 +318,12 @@ class Gist(github.GithubObject.CompletableGithubObject):
|
||||
if "files" in attributes: # pragma no branch
|
||||
assert attributes["files"] is None or all(isinstance(element, dict) for element in attributes["files"].itervalues()), attributes["files"]
|
||||
self._files = None if attributes["files"] is None else dict(
|
||||
(key, github.GistFile.GistFile(self._requester, element, completed=False))
|
||||
(key, github.GistFile.GistFile(self._requester, self._headers, element, completed=False))
|
||||
for key, element in attributes["files"].iteritems()
|
||||
)
|
||||
if "fork_of" in attributes: # pragma no branch
|
||||
assert attributes["fork_of"] is None or isinstance(attributes["fork_of"], dict), attributes["fork_of"]
|
||||
self._fork_of = None if attributes["fork_of"] is None else Gist(self._requester, attributes["fork_of"], completed=False)
|
||||
self._fork_of = None if attributes["fork_of"] is None else Gist(self._requester, self._headers, attributes["fork_of"], completed=False)
|
||||
if "forks" in attributes: # pragma no branch
|
||||
assert attributes["forks"] is None or all(isinstance(element, dict) for element in attributes["forks"]), attributes["forks"]
|
||||
self._forks = None if attributes["forks"] is None else [
|
||||
@@ -338,7 +339,7 @@ class Gist(github.GithubObject.CompletableGithubObject):
|
||||
if "history" in attributes: # pragma no branch
|
||||
assert attributes["history"] is None or all(isinstance(element, dict) for element in attributes["history"]), attributes["history"]
|
||||
self._history = None if attributes["history"] is None else [
|
||||
github.GistHistoryState.GistHistoryState(self._requester, element, completed=False)
|
||||
github.GistHistoryState.GistHistoryState(self._requester, self._headers, element, completed=False)
|
||||
for element in attributes["history"]
|
||||
]
|
||||
if "html_url" in attributes: # pragma no branch
|
||||
@@ -358,4 +359,4 @@ class Gist(github.GithubObject.CompletableGithubObject):
|
||||
self._url = attributes["url"]
|
||||
if "user" in attributes: # pragma no branch
|
||||
assert attributes["user"] is None or isinstance(attributes["user"], dict), attributes["user"]
|
||||
self._user = None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, attributes["user"], completed=False)
|
||||
self._user = None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, self._headers, attributes["user"], completed=False)
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
@@ -137,4 +138,4 @@ class GistComment(github.GithubObject.CompletableGithubObject):
|
||||
self._url = attributes["url"]
|
||||
if "user" in attributes: # pragma no branch
|
||||
assert attributes["user"] is None or isinstance(attributes["user"], dict), attributes["user"]
|
||||
self._user = None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, attributes["user"], completed=False)
|
||||
self._user = None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, self._headers, attributes["user"], completed=False)
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
@@ -84,7 +85,7 @@ class GistHistoryState(github.GithubObject.CompletableGithubObject):
|
||||
def _useAttributes(self, attributes):
|
||||
if "change_status" in attributes: # pragma no branch
|
||||
assert attributes["change_status"] is None or isinstance(attributes["change_status"], dict), attributes["change_status"]
|
||||
self._change_status = None if attributes["change_status"] is None else github.CommitStats.CommitStats(self._requester, attributes["change_status"], completed=False)
|
||||
self._change_status = None if attributes["change_status"] is None else github.CommitStats.CommitStats(self._requester, self._headers, attributes["change_status"], completed=False)
|
||||
if "committed_at" in attributes: # pragma no branch
|
||||
assert attributes["committed_at"] is None or isinstance(attributes["committed_at"], (str, unicode)), attributes["committed_at"]
|
||||
self._committed_at = self._parseDatetime(attributes["committed_at"])
|
||||
@@ -93,7 +94,7 @@ class GistHistoryState(github.GithubObject.CompletableGithubObject):
|
||||
self._url = attributes["url"]
|
||||
if "user" in attributes: # pragma no branch
|
||||
assert attributes["user"] is None or isinstance(attributes["user"], dict), attributes["user"]
|
||||
self._user = None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, attributes["user"], completed=False)
|
||||
self._user = None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, self._headers, attributes["user"], completed=False)
|
||||
if "version" in attributes: # pragma no branch
|
||||
assert attributes["version"] is None or isinstance(attributes["version"], (str, unicode)), attributes["version"]
|
||||
self._version = attributes["version"]
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
|
||||
+5
-4
@@ -4,6 +4,7 @@
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
@@ -106,17 +107,17 @@ class GitCommit(github.GithubObject.CompletableGithubObject):
|
||||
def _useAttributes(self, attributes):
|
||||
if "author" in attributes: # pragma no branch
|
||||
assert attributes["author"] is None or isinstance(attributes["author"], dict), attributes["author"]
|
||||
self._author = None if attributes["author"] is None else github.GitAuthor.GitAuthor(self._requester, attributes["author"], completed=False)
|
||||
self._author = None if attributes["author"] is None else github.GitAuthor.GitAuthor(self._requester, self._headers, attributes["author"], completed=False)
|
||||
if "committer" in attributes: # pragma no branch
|
||||
assert attributes["committer"] is None or isinstance(attributes["committer"], dict), attributes["committer"]
|
||||
self._committer = None if attributes["committer"] is None else github.GitAuthor.GitAuthor(self._requester, attributes["committer"], completed=False)
|
||||
self._committer = None if attributes["committer"] is None else github.GitAuthor.GitAuthor(self._requester, self._headers, attributes["committer"], completed=False)
|
||||
if "message" in attributes: # pragma no branch
|
||||
assert attributes["message"] is None or isinstance(attributes["message"], (str, unicode)), attributes["message"]
|
||||
self._message = attributes["message"]
|
||||
if "parents" in attributes: # pragma no branch
|
||||
assert attributes["parents"] is None or all(isinstance(element, dict) for element in attributes["parents"]), attributes["parents"]
|
||||
self._parents = None if attributes["parents"] is None else [
|
||||
GitCommit(self._requester, element, completed=False)
|
||||
GitCommit(self._requester, self._headers, element, completed=False)
|
||||
for element in attributes["parents"]
|
||||
]
|
||||
if "sha" in attributes: # pragma no branch
|
||||
@@ -124,7 +125,7 @@ class GitCommit(github.GithubObject.CompletableGithubObject):
|
||||
self._sha = attributes["sha"]
|
||||
if "tree" in attributes: # pragma no branch
|
||||
assert attributes["tree"] is None or isinstance(attributes["tree"], dict), attributes["tree"]
|
||||
self._tree = None if attributes["tree"] is None else github.GitTree.GitTree(self._requester, attributes["tree"], completed=False)
|
||||
self._tree = None if attributes["tree"] is None else github.GitTree.GitTree(self._requester, self._headers, attributes["tree"], completed=False)
|
||||
if "url" in attributes: # pragma no branch
|
||||
assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"]
|
||||
self._url = attributes["url"]
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
|
||||
+2
-1
@@ -4,6 +4,7 @@
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
@@ -99,7 +100,7 @@ class GitRef(github.GithubObject.CompletableGithubObject):
|
||||
def _useAttributes(self, attributes):
|
||||
if "object" in attributes: # pragma no branch
|
||||
assert attributes["object"] is None or isinstance(attributes["object"], dict), attributes["object"]
|
||||
self._object = None if attributes["object"] is None else github.GitObject.GitObject(self._requester, attributes["object"], completed=False)
|
||||
self._object = None if attributes["object"] is None else github.GitObject.GitObject(self._requester, self._headers, attributes["object"], completed=False)
|
||||
if "ref" in attributes: # pragma no branch
|
||||
assert attributes["ref"] is None or isinstance(attributes["ref"], (str, unicode)), attributes["ref"]
|
||||
self._ref = attributes["ref"]
|
||||
|
||||
+3
-2
@@ -4,6 +4,7 @@
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
@@ -96,7 +97,7 @@ class GitTag(github.GithubObject.CompletableGithubObject):
|
||||
self._message = attributes["message"]
|
||||
if "object" in attributes: # pragma no branch
|
||||
assert attributes["object"] is None or isinstance(attributes["object"], dict), attributes["object"]
|
||||
self._object = None if attributes["object"] is None else github.GitObject.GitObject(self._requester, attributes["object"], completed=False)
|
||||
self._object = None if attributes["object"] is None else github.GitObject.GitObject(self._requester, self._headers, attributes["object"], completed=False)
|
||||
if "sha" in attributes: # pragma no branch
|
||||
assert attributes["sha"] is None or isinstance(attributes["sha"], (str, unicode)), attributes["sha"]
|
||||
self._sha = attributes["sha"]
|
||||
@@ -105,7 +106,7 @@ class GitTag(github.GithubObject.CompletableGithubObject):
|
||||
self._tag = attributes["tag"]
|
||||
if "tagger" in attributes: # pragma no branch
|
||||
assert attributes["tagger"] is None or isinstance(attributes["tagger"], dict), attributes["tagger"]
|
||||
self._tagger = None if attributes["tagger"] is None else github.GitAuthor.GitAuthor(self._requester, attributes["tagger"], completed=False)
|
||||
self._tagger = None if attributes["tagger"] is None else github.GitAuthor.GitAuthor(self._requester, self._headers, attributes["tagger"], completed=False)
|
||||
if "url" in attributes: # pragma no branch
|
||||
assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"]
|
||||
self._url = attributes["url"]
|
||||
|
||||
+2
-1
@@ -4,6 +4,7 @@
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
@@ -73,7 +74,7 @@ class GitTree(github.GithubObject.CompletableGithubObject):
|
||||
if "tree" in attributes: # pragma no branch
|
||||
assert attributes["tree"] is None or all(isinstance(element, dict) for element in attributes["tree"]), attributes["tree"]
|
||||
self._tree = None if attributes["tree"] is None else [
|
||||
github.GitTreeElement.GitTreeElement(self._requester, element, completed=False)
|
||||
github.GitTreeElement.GitTreeElement(self._requester, self._headers, element, completed=False)
|
||||
for element in attributes["tree"]
|
||||
]
|
||||
if "url" in attributes: # pragma no branch
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
|
||||
+23
-3
@@ -4,6 +4,7 @@
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
@@ -38,11 +39,29 @@ class GithubObject(object):
|
||||
"""
|
||||
Base class for all classes representing objects returned by the API.
|
||||
"""
|
||||
def __init__(self, requester, attributes, completed):
|
||||
|
||||
'''
|
||||
A global debug flag to enable header validation by requester for all objects
|
||||
'''
|
||||
CHECK_AFTER_INIT_FLAG = False
|
||||
|
||||
@classmethod
|
||||
def setCheckAfterInitFlag(cls, flag):
|
||||
cls.CHECK_AFTER_INIT_FLAG = flag
|
||||
|
||||
def __init__(self, requester, headers, attributes, completed):
|
||||
self._requester = requester
|
||||
# Make sure headers are signed before any operations on attributes
|
||||
# Object creatation requires headers as parameter
|
||||
self._headers = headers;
|
||||
self._initAttributes()
|
||||
self._storeAndUseAttributes(attributes)
|
||||
|
||||
# Ask requester to do some checking, for debug and test purpose
|
||||
# Since it's most handy to access and kinda all-knowing
|
||||
if (self.CHECK_AFTER_INIT_FLAG):
|
||||
requester.check_me(self);
|
||||
|
||||
def _storeAndUseAttributes(self, attributes):
|
||||
self._useAttributes(attributes)
|
||||
self._rawData = attributes
|
||||
@@ -84,8 +103,8 @@ class NonCompletableGithubObject(GithubObject):
|
||||
|
||||
|
||||
class CompletableGithubObject(GithubObject):
|
||||
def __init__(self, requester, attributes, completed):
|
||||
GithubObject.__init__(self, requester, attributes, completed)
|
||||
def __init__(self, requester, headers, attributes, completed):
|
||||
GithubObject.__init__(self, requester, headers, attributes, completed)
|
||||
self.__completed = completed
|
||||
|
||||
def _completeIfNotSet(self, value):
|
||||
@@ -103,5 +122,6 @@ class CompletableGithubObject(GithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
self._headers = headers
|
||||
self._storeAndUseAttributes(data)
|
||||
self.__completed = True
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
############################ Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
|
||||
+2
-1
@@ -4,6 +4,7 @@
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
@@ -195,7 +196,7 @@ class Hook(github.GithubObject.CompletableGithubObject):
|
||||
self._id = attributes["id"]
|
||||
if "last_response" in attributes: # pragma no branch
|
||||
assert attributes["last_response"] is None or isinstance(attributes["last_response"], dict), attributes["last_response"]
|
||||
self._last_response = None if attributes["last_response"] is None else github.HookResponse.HookResponse(self._requester, attributes["last_response"], completed=False)
|
||||
self._last_response = None if attributes["last_response"] is None else github.HookResponse.HookResponse(self._requester, self._headers, attributes["last_response"], completed=False)
|
||||
if "name" in attributes: # pragma no branch
|
||||
assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"]
|
||||
self._name = attributes["name"]
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
|
||||
+10
-9
@@ -6,6 +6,7 @@
|
||||
# Copyright 2012 Philip Kimmey <philip@rover.com> #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Stuart Glaser <stuglaser@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
@@ -222,7 +223,7 @@ class Issue(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return github.IssueComment.IssueComment(self._requester, data, completed=True)
|
||||
return github.IssueComment.IssueComment(self._requester, headers, data, completed=True)
|
||||
|
||||
def delete_labels(self):
|
||||
"""
|
||||
@@ -287,7 +288,7 @@ class Issue(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return github.IssueComment.IssueComment(self._requester, data, completed=True)
|
||||
return github.IssueComment.IssueComment(self._requester, headers, data, completed=True)
|
||||
|
||||
def get_comments(self):
|
||||
"""
|
||||
@@ -381,7 +382,7 @@ class Issue(github.GithubObject.CompletableGithubObject):
|
||||
def _useAttributes(self, attributes):
|
||||
if "assignee" in attributes: # pragma no branch
|
||||
assert attributes["assignee"] is None or isinstance(attributes["assignee"], dict), attributes["assignee"]
|
||||
self._assignee = None if attributes["assignee"] is None else github.NamedUser.NamedUser(self._requester, attributes["assignee"], completed=False)
|
||||
self._assignee = None if attributes["assignee"] is None else github.NamedUser.NamedUser(self._requester, self._headers, attributes["assignee"], completed=False)
|
||||
if "body" in attributes: # pragma no branch
|
||||
assert attributes["body"] is None or isinstance(attributes["body"], (str, unicode)), attributes["body"]
|
||||
self._body = attributes["body"]
|
||||
@@ -390,7 +391,7 @@ class Issue(github.GithubObject.CompletableGithubObject):
|
||||
self._closed_at = self._parseDatetime(attributes["closed_at"])
|
||||
if "closed_by" in attributes: # pragma no branch
|
||||
assert attributes["closed_by"] is None or isinstance(attributes["closed_by"], dict), attributes["closed_by"]
|
||||
self._closed_by = None if attributes["closed_by"] is None else github.NamedUser.NamedUser(self._requester, attributes["closed_by"], completed=False)
|
||||
self._closed_by = None if attributes["closed_by"] is None else github.NamedUser.NamedUser(self._requester, self._headers, attributes["closed_by"], completed=False)
|
||||
if "comments" in attributes: # pragma no branch
|
||||
assert attributes["comments"] is None or isinstance(attributes["comments"], (int, long)), attributes["comments"]
|
||||
self._comments = attributes["comments"]
|
||||
@@ -406,21 +407,21 @@ class Issue(github.GithubObject.CompletableGithubObject):
|
||||
if "labels" in attributes: # pragma no branch
|
||||
assert attributes["labels"] is None or all(isinstance(element, dict) for element in attributes["labels"]), attributes["labels"]
|
||||
self._labels = None if attributes["labels"] is None else [
|
||||
github.Label.Label(self._requester, element, completed=False)
|
||||
github.Label.Label(self._requester, self._headers, element, completed=False)
|
||||
for element in attributes["labels"]
|
||||
]
|
||||
if "milestone" in attributes: # pragma no branch
|
||||
assert attributes["milestone"] is None or isinstance(attributes["milestone"], dict), attributes["milestone"]
|
||||
self._milestone = None if attributes["milestone"] is None else github.Milestone.Milestone(self._requester, attributes["milestone"], completed=False)
|
||||
self._milestone = None if attributes["milestone"] is None else github.Milestone.Milestone(self._requester, self._headers, attributes["milestone"], completed=False)
|
||||
if "number" in attributes: # pragma no branch
|
||||
assert attributes["number"] is None or isinstance(attributes["number"], (int, long)), attributes["number"]
|
||||
self._number = attributes["number"]
|
||||
if "pull_request" in attributes: # pragma no branch
|
||||
assert attributes["pull_request"] is None or isinstance(attributes["pull_request"], dict), attributes["pull_request"]
|
||||
self._pull_request = None if attributes["pull_request"] is None else github.IssuePullRequest.IssuePullRequest(self._requester, attributes["pull_request"], completed=False)
|
||||
self._pull_request = None if attributes["pull_request"] is None else github.IssuePullRequest.IssuePullRequest(self._requester, self._headers, attributes["pull_request"], completed=False)
|
||||
if "repository" in attributes: # pragma no branch
|
||||
assert attributes["repository"] is None or isinstance(attributes["repository"], dict), attributes["repository"]
|
||||
self._repository = None if attributes["repository"] is None else github.Repository.Repository(self._requester, attributes["repository"], completed=False)
|
||||
self._repository = None if attributes["repository"] is None else github.Repository.Repository(self._requester, self._headers, attributes["repository"], completed=False)
|
||||
if "state" in attributes: # pragma no branch
|
||||
assert attributes["state"] is None or isinstance(attributes["state"], (str, unicode)), attributes["state"]
|
||||
self._state = attributes["state"]
|
||||
@@ -435,4 +436,4 @@ class Issue(github.GithubObject.CompletableGithubObject):
|
||||
self._url = attributes["url"]
|
||||
if "user" in attributes: # pragma no branch
|
||||
assert attributes["user"] is None or isinstance(attributes["user"], dict), attributes["user"]
|
||||
self._user = None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, attributes["user"], completed=False)
|
||||
self._user = None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, self._headers, attributes["user"], completed=False)
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Michael Stead <michael.stead@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
@@ -150,4 +151,4 @@ class IssueComment(github.GithubObject.CompletableGithubObject):
|
||||
self._html_url = attributes["html_url"]
|
||||
if "user" in attributes: # pragma no branch
|
||||
assert attributes["user"] is None or isinstance(attributes["user"], dict), attributes["user"]
|
||||
self._user = None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, attributes["user"], completed=False)
|
||||
self._user = None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, self._headers, attributes["user"], completed=False)
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
@@ -102,7 +103,7 @@ class IssueEvent(github.GithubObject.CompletableGithubObject):
|
||||
def _useAttributes(self, attributes):
|
||||
if "actor" in attributes: # pragma no branch
|
||||
assert attributes["actor"] is None or isinstance(attributes["actor"], dict), attributes["actor"]
|
||||
self._actor = None if attributes["actor"] is None else github.NamedUser.NamedUser(self._requester, attributes["actor"], completed=False)
|
||||
self._actor = None if attributes["actor"] is None else github.NamedUser.NamedUser(self._requester, self._headers, attributes["actor"], completed=False)
|
||||
if "commit_id" in attributes: # pragma no branch
|
||||
assert attributes["commit_id"] is None or isinstance(attributes["commit_id"], (str, unicode)), attributes["commit_id"]
|
||||
self._commit_id = attributes["commit_id"]
|
||||
@@ -117,7 +118,7 @@ class IssueEvent(github.GithubObject.CompletableGithubObject):
|
||||
self._id = attributes["id"]
|
||||
if "issue" in attributes: # pragma no branch
|
||||
assert attributes["issue"] is None or isinstance(attributes["issue"], dict), attributes["issue"]
|
||||
self._issue = None if attributes["issue"] is None else github.Issue.Issue(self._requester, attributes["issue"], completed=False)
|
||||
self._issue = None if attributes["issue"] is None else github.Issue.Issue(self._requester, self._headers, attributes["issue"], completed=False)
|
||||
if "url" in attributes: # pragma no branch
|
||||
assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"]
|
||||
self._url = attributes["url"]
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2013 martinqt <m.ki2@laposte.net> #
|
||||
# #
|
||||
|
||||
+3
-1
@@ -5,6 +5,7 @@
|
||||
# Copyright 2012 Steve English <steve.english@navetas.com> #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
@@ -61,8 +62,9 @@ class PaginatedList(github.PaginatedList.PaginatedListBase):
|
||||
None
|
||||
)
|
||||
self.__continue = len(data[self.__key]) > 0
|
||||
|
||||
return [
|
||||
self.__contentClass(self.__requester, self.__convert(element), completed=False)
|
||||
self.__contentClass(self.__requester, headers, self.__convert(element), completed=False)
|
||||
for element in data[self.__key]
|
||||
]
|
||||
|
||||
|
||||
+11
-10
@@ -2,6 +2,7 @@
|
||||
|
||||
############################ Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Ed Jackson <ed.jackson@gmail.com> #
|
||||
# Copyright 2013 Jonathan J Hunt <hunt@braincorporation.com> #
|
||||
# Copyright 2013 Peter Golm <golm.peter@gmail.com> #
|
||||
@@ -139,7 +140,7 @@ class Github(object):
|
||||
"""
|
||||
assert login is github.GithubObject.NotSet or isinstance(login, (str, unicode)), login
|
||||
if login is github.GithubObject.NotSet:
|
||||
return AuthenticatedUser.AuthenticatedUser(self.__requester, {"url": "/user"}, completed=False)
|
||||
return AuthenticatedUser.AuthenticatedUser(self.__requester, {}, {"url": "/user"}, completed=False)
|
||||
else:
|
||||
headers, data = self.__requester.requestJsonAndCheck(
|
||||
"GET",
|
||||
@@ -147,7 +148,7 @@ class Github(object):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return github.NamedUser.NamedUser(self.__requester, data, completed=True)
|
||||
return github.NamedUser.NamedUser(self.__requester, headers, data, completed=True)
|
||||
|
||||
def get_users(self, since=github.GithubObject.NotSet):
|
||||
"""
|
||||
@@ -179,7 +180,7 @@ class Github(object):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return github.Organization.Organization(self.__requester, data, completed=True)
|
||||
return github.Organization.Organization(self.__requester, headers, data, completed=True)
|
||||
|
||||
def get_repo(self, full_name):
|
||||
"""
|
||||
@@ -193,7 +194,7 @@ class Github(object):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return Repository.Repository(self.__requester, data, completed=True)
|
||||
return Repository.Repository(self.__requester, headers, data, completed=True)
|
||||
|
||||
def get_repos(self, since=github.GithubObject.NotSet):
|
||||
"""
|
||||
@@ -225,7 +226,7 @@ class Github(object):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return github.Gist.Gist(self.__requester, data, completed=True)
|
||||
return github.Gist.Gist(self.__requester, headers, data, completed=True)
|
||||
|
||||
def get_gists(self):
|
||||
"""
|
||||
@@ -287,7 +288,7 @@ class Github(object):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return github.NamedUser.NamedUser(self.__requester, Legacy.convertUser(data["user"]), completed=False)
|
||||
return github.NamedUser.NamedUser(self.__requester, headers, Legacy.convertUser(data["user"]), completed=False)
|
||||
|
||||
def render_markdown(self, text, context=github.GithubObject.NotSet):
|
||||
"""
|
||||
@@ -323,7 +324,7 @@ class Github(object):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return [HookDescription.HookDescription(self.__requester, attributes, completed=True) for attributes in data]
|
||||
return [HookDescription.HookDescription(self.__requester, headers, attributes, completed=True) for attributes in data]
|
||||
|
||||
def get_gitignore_templates(self):
|
||||
"""
|
||||
@@ -350,9 +351,9 @@ class Github(object):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return GitignoreTemplate.GitignoreTemplate(self.__requester, attributes, completed=True)
|
||||
return GitignoreTemplate.GitignoreTemplate(self.__requester, headers, attributes, completed=True)
|
||||
|
||||
def create_from_raw_data(self, klass, raw_data):
|
||||
def create_from_raw_data(self, klass, raw_data, headers={}):
|
||||
"""
|
||||
Creates an object from raw_data previously obtained by :attr:`github.GithubObject.GithubObject.raw_data`
|
||||
|
||||
@@ -360,4 +361,4 @@ class Github(object):
|
||||
:param raw_data: dict
|
||||
:rtype: instance of class ``klass``
|
||||
"""
|
||||
return klass(self.__requester, raw_data, completed=True)
|
||||
return klass(self.__requester, headers, raw_data, completed=True)
|
||||
|
||||
+2
-1
@@ -4,6 +4,7 @@
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2013 martinqt <m.ki2@laposte.net> #
|
||||
# #
|
||||
@@ -206,7 +207,7 @@ class Milestone(github.GithubObject.CompletableGithubObject):
|
||||
self._created_at = self._parseDatetime(attributes["created_at"])
|
||||
if "creator" in attributes: # pragma no branch
|
||||
assert attributes["creator"] is None or isinstance(attributes["creator"], dict), attributes["creator"]
|
||||
self._creator = None if attributes["creator"] is None else github.NamedUser.NamedUser(self._requester, attributes["creator"], completed=False)
|
||||
self._creator = None if attributes["creator"] is None else github.NamedUser.NamedUser(self._requester, self._headers, attributes["creator"], completed=False)
|
||||
if "description" in attributes: # pragma no branch
|
||||
assert attributes["description"] is None or isinstance(attributes["description"], (str, unicode)), attributes["description"]
|
||||
self._description = attributes["description"]
|
||||
|
||||
+4
-3
@@ -5,6 +5,7 @@
|
||||
# Copyright 2012 Steve English <steve.english@navetas.com> #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
@@ -271,7 +272,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return github.Gist.Gist(self._requester, data, completed=True)
|
||||
return github.Gist.Gist(self._requester, headers, data, completed=True)
|
||||
|
||||
def get_events(self):
|
||||
"""
|
||||
@@ -394,7 +395,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return github.Repository.Repository(self._requester, data, completed=True)
|
||||
return github.Repository.Repository(self._requester, headers, data, completed=True)
|
||||
|
||||
def get_repos(self, type=github.GithubObject.NotSet):
|
||||
"""
|
||||
@@ -556,7 +557,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject):
|
||||
self._owned_private_repos = attributes["owned_private_repos"]
|
||||
if "plan" in attributes: # pragma no branch
|
||||
assert attributes["plan"] is None or isinstance(attributes["plan"], dict), attributes["plan"]
|
||||
self._plan = None if attributes["plan"] is None else github.Plan.Plan(self._requester, attributes["plan"], completed=False)
|
||||
self._plan = None if attributes["plan"] is None else github.Plan.Plan(self._requester, self._headers, attributes["plan"], completed=False)
|
||||
if "private_gists" in attributes: # pragma no branch
|
||||
assert attributes["private_gists"] is None or isinstance(attributes["private_gists"], (int, long)), attributes["private_gists"]
|
||||
self._private_gists = attributes["private_gists"]
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
############################ Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Peter Golm <golm.peter@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2013 martinqt <m.ki2@laposte.net> #
|
||||
@@ -104,10 +105,10 @@ class Notification(github.GithubObject.CompletableGithubObject):
|
||||
self._id = attributes["id"]
|
||||
if "repository" in attributes: # pragma no branch
|
||||
assert attributes["repository"] is None or isinstance(attributes["repository"], dict), attributes["repository"]
|
||||
self._repository = None if attributes["repository"] is None else github.Repository.Repository(self._requester, attributes["repository"], completed=False)
|
||||
self._repository = None if attributes["repository"] is None else github.Repository.Repository(self._requester, self._headers, attributes["repository"], completed=False)
|
||||
if "subject" in attributes: # pragma no branch
|
||||
assert attributes["subject"] is None or isinstance(attributes["subject"], dict), attributes["subject"]
|
||||
self._subject = None if attributes["subject"] is None else github.NotificationSubject.NotificationSubject(self._requester, attributes["subject"], completed=False)
|
||||
self._subject = None if attributes["subject"] is None else github.NotificationSubject.NotificationSubject(self._requester, self._headers, attributes["subject"], completed=False)
|
||||
if "reason" in attributes: # pragma no branch
|
||||
assert attributes["reason"] is None or isinstance(attributes["reason"], (str, unicode)), attributes["reason"]
|
||||
self._reason = attributes["reason"]
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
############################ Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
# Copyright 2012 Steve English <steve.english@navetas.com> #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2013 martinqt <m.ki2@laposte.net> #
|
||||
# #
|
||||
@@ -264,7 +265,7 @@ class Organization(github.GithubObject.CompletableGithubObject):
|
||||
url_parameters,
|
||||
None
|
||||
)
|
||||
return github.Repository.Repository(self._requester, data, completed=True)
|
||||
return github.Repository.Repository(self._requester, headers, data, completed=True)
|
||||
|
||||
def create_repo(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, team_id=github.GithubObject.NotSet, auto_init=github.GithubObject.NotSet, gitignore_template=github.GithubObject.NotSet):
|
||||
"""
|
||||
@@ -318,7 +319,7 @@ class Organization(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return github.Repository.Repository(self._requester, data, completed=True)
|
||||
return github.Repository.Repository(self._requester, headers, data, completed=True)
|
||||
|
||||
def create_team(self, name, repo_names=github.GithubObject.NotSet, permission=github.GithubObject.NotSet):
|
||||
"""
|
||||
@@ -344,7 +345,7 @@ class Organization(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return github.Team.Team(self._requester, data, completed=True)
|
||||
return github.Team.Team(self._requester, headers, data, completed=True)
|
||||
|
||||
def edit(self, billing_email=github.GithubObject.NotSet, blog=github.GithubObject.NotSet, company=github.GithubObject.NotSet, email=github.GithubObject.NotSet, location=github.GithubObject.NotSet, name=github.GithubObject.NotSet):
|
||||
"""
|
||||
@@ -471,7 +472,7 @@ class Organization(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return github.Repository.Repository(self._requester, data, completed=True)
|
||||
return github.Repository.Repository(self._requester, headers, data, completed=True)
|
||||
|
||||
def get_repos(self, type=github.GithubObject.NotSet):
|
||||
"""
|
||||
@@ -503,7 +504,7 @@ class Organization(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return github.Team.Team(self._requester, data, completed=True)
|
||||
return github.Team.Team(self._requester, headers, data, completed=True)
|
||||
|
||||
def get_teams(self):
|
||||
"""
|
||||
@@ -655,7 +656,7 @@ class Organization(github.GithubObject.CompletableGithubObject):
|
||||
self._owned_private_repos = attributes["owned_private_repos"]
|
||||
if "plan" in attributes: # pragma no branch
|
||||
assert attributes["plan"] is None or isinstance(attributes["plan"], dict), attributes["plan"]
|
||||
self._plan = None if attributes["plan"] is None else github.Plan.Plan(self._requester, attributes["plan"], completed=False)
|
||||
self._plan = None if attributes["plan"] is None else github.Plan.Plan(self._requester, self._headers, attributes["plan"], completed=False)
|
||||
if "private_gists" in attributes: # pragma no branch
|
||||
assert attributes["private_gists"] is None or isinstance(attributes["private_gists"], (int, long)), attributes["private_gists"]
|
||||
self._private_gists = attributes["private_gists"]
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Bill Mill <bill.mill@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2013 davidbrai <davidbrai@gmail.com> #
|
||||
@@ -152,7 +153,7 @@ class PaginatedList(PaginatedListBase):
|
||||
self.__nextParams = None
|
||||
|
||||
content = [
|
||||
self.__contentClass(self.__requester, element, completed=False)
|
||||
self.__contentClass(self.__requester, headers, element, completed=False)
|
||||
for element in data
|
||||
]
|
||||
if self._reversed:
|
||||
@@ -179,6 +180,6 @@ class PaginatedList(PaginatedListBase):
|
||||
headers, data = self.__requester.requestJsonAndCheck("GET", self.__firstUrl, params, None)
|
||||
|
||||
return [
|
||||
self.__contentClass(self.__requester, element, completed=False)
|
||||
self.__contentClass(self.__requester, headers, element, completed=False)
|
||||
for element in data
|
||||
]
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
|
||||
+11
-10
@@ -5,6 +5,7 @@
|
||||
# Copyright 2012 Michael Stead <michael.stead@gmail.com> #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2013 martinqt <m.ki2@laposte.net> #
|
||||
# #
|
||||
@@ -294,7 +295,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return github.PullRequestComment.PullRequestComment(self._requester, data, completed=True)
|
||||
return github.PullRequestComment.PullRequestComment(self._requester, headers, data, completed=True)
|
||||
|
||||
def create_issue_comment(self, body):
|
||||
"""
|
||||
@@ -312,7 +313,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return github.IssueComment.IssueComment(self._requester, data, completed=True)
|
||||
return github.IssueComment.IssueComment(self._requester, headers, data, completed=True)
|
||||
|
||||
def edit(self, title=github.GithubObject.NotSet, body=github.GithubObject.NotSet, state=github.GithubObject.NotSet):
|
||||
"""
|
||||
@@ -361,7 +362,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return github.PullRequestComment.PullRequestComment(self._requester, data, completed=True)
|
||||
return github.PullRequestComment.PullRequestComment(self._requester, headers, data, completed=True)
|
||||
|
||||
def get_comments(self):
|
||||
"""
|
||||
@@ -419,7 +420,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return github.IssueComment.IssueComment(self._requester, data, completed=True)
|
||||
return github.IssueComment.IssueComment(self._requester, headers, data, completed=True)
|
||||
|
||||
def get_issue_comments(self):
|
||||
"""
|
||||
@@ -462,7 +463,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return github.PullRequestMergeStatus.PullRequestMergeStatus(self._requester, data, completed=True)
|
||||
return github.PullRequestMergeStatus.PullRequestMergeStatus(self._requester, headers, data, completed=True)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._additions = github.GithubObject.NotSet
|
||||
@@ -499,10 +500,10 @@ class PullRequest(github.GithubObject.CompletableGithubObject):
|
||||
self._additions = attributes["additions"]
|
||||
if "assignee" in attributes: # pragma no branch
|
||||
assert attributes["assignee"] is None or isinstance(attributes["assignee"], dict), attributes["assignee"]
|
||||
self._assignee = None if attributes["assignee"] is None else github.NamedUser.NamedUser(self._requester, attributes["assignee"], completed=False)
|
||||
self._assignee = None if attributes["assignee"] is None else github.NamedUser.NamedUser(self._requester, self._headers, attributes["assignee"], completed=False)
|
||||
if "base" in attributes: # pragma no branch
|
||||
assert attributes["base"] is None or isinstance(attributes["base"], dict), attributes["base"]
|
||||
self._base = None if attributes["base"] is None else github.PullRequestPart.PullRequestPart(self._requester, attributes["base"], completed=False)
|
||||
self._base = None if attributes["base"] is None else github.PullRequestPart.PullRequestPart(self._requester, self._headers, attributes["base"], completed=False)
|
||||
if "body" in attributes: # pragma no branch
|
||||
assert attributes["body"] is None or isinstance(attributes["body"], (str, unicode)), attributes["body"]
|
||||
self._body = attributes["body"]
|
||||
@@ -529,7 +530,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject):
|
||||
self._diff_url = attributes["diff_url"]
|
||||
if "head" in attributes: # pragma no branch
|
||||
assert attributes["head"] is None or isinstance(attributes["head"], dict), attributes["head"]
|
||||
self._head = None if attributes["head"] is None else github.PullRequestPart.PullRequestPart(self._requester, attributes["head"], completed=False)
|
||||
self._head = None if attributes["head"] is None else github.PullRequestPart.PullRequestPart(self._requester, self._headers, attributes["head"], completed=False)
|
||||
if "html_url" in attributes: # pragma no branch
|
||||
assert attributes["html_url"] is None or isinstance(attributes["html_url"], (str, unicode)), attributes["html_url"]
|
||||
self._html_url = attributes["html_url"]
|
||||
@@ -550,7 +551,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject):
|
||||
self._merged_at = self._parseDatetime(attributes["merged_at"])
|
||||
if "merged_by" in attributes: # pragma no branch
|
||||
assert attributes["merged_by"] is None or isinstance(attributes["merged_by"], dict), attributes["merged_by"]
|
||||
self._merged_by = None if attributes["merged_by"] is None else github.NamedUser.NamedUser(self._requester, attributes["merged_by"], completed=False)
|
||||
self._merged_by = None if attributes["merged_by"] is None else github.NamedUser.NamedUser(self._requester, self._headers, attributes["merged_by"], completed=False)
|
||||
if "number" in attributes: # pragma no branch
|
||||
assert attributes["number"] is None or isinstance(attributes["number"], (int, long)), attributes["number"]
|
||||
self._number = attributes["number"]
|
||||
@@ -574,4 +575,4 @@ class PullRequest(github.GithubObject.CompletableGithubObject):
|
||||
self._url = attributes["url"]
|
||||
if "user" in attributes: # pragma no branch
|
||||
assert attributes["user"] is None or isinstance(attributes["user"], dict), attributes["user"]
|
||||
self._user = None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, attributes["user"], completed=False)
|
||||
self._user = None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, self._headers, attributes["user"], completed=False)
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Michael Stead <michael.stead@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2013 martinqt <m.ki2@laposte.net> #
|
||||
@@ -211,4 +212,4 @@ class PullRequestComment(github.GithubObject.CompletableGithubObject):
|
||||
self._html_url = attributes["html_url"]
|
||||
if "user" in attributes: # pragma no branch
|
||||
assert attributes["user"] is None or isinstance(attributes["user"], dict), attributes["user"]
|
||||
self._user = None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, attributes["user"], completed=False)
|
||||
self._user = None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, self._headers, attributes["user"], completed=False)
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2013 martinqt <m.ki2@laposte.net> #
|
||||
# #
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
@@ -85,10 +86,10 @@ class PullRequestPart(github.GithubObject.NonCompletableGithubObject):
|
||||
self._ref = attributes["ref"]
|
||||
if "repo" in attributes: # pragma no branch
|
||||
assert attributes["repo"] is None or isinstance(attributes["repo"], dict), attributes["repo"]
|
||||
self._repo = None if attributes["repo"] is None else github.Repository.Repository(self._requester, attributes["repo"], completed=False)
|
||||
self._repo = None if attributes["repo"] is None else github.Repository.Repository(self._requester, self._headers, attributes["repo"], completed=False)
|
||||
if "sha" in attributes: # pragma no branch
|
||||
assert attributes["sha"] is None or isinstance(attributes["sha"], (str, unicode)), attributes["sha"]
|
||||
self._sha = attributes["sha"]
|
||||
if "user" in attributes: # pragma no branch
|
||||
assert attributes["user"] is None or isinstance(attributes["user"], dict), attributes["user"]
|
||||
self._user = None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, attributes["user"], completed=False)
|
||||
self._user = None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, self._headers, attributes["user"], completed=False)
|
||||
|
||||
+41
-40
@@ -7,6 +7,7 @@
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 Adrian Petrescu <adrian.petrescu@maluuba.com> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Mark Roddy <markroddy@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2013 martinqt <m.ki2@laposte.net> #
|
||||
@@ -336,7 +337,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return github.Comparison.Comparison(self._requester, data, completed=True)
|
||||
return github.Comparison.Comparison(self._requester, headers, data, completed=True)
|
||||
|
||||
def create_download(self, name, size, description=github.GithubObject.NotSet, content_type=github.GithubObject.NotSet):
|
||||
"""
|
||||
@@ -365,7 +366,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return github.Download.Download(self._requester, data, completed=True)
|
||||
return github.Download.Download(self._requester, headers, data, completed=True)
|
||||
|
||||
def create_git_blob(self, content, encoding):
|
||||
"""
|
||||
@@ -386,7 +387,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return github.GitBlob.GitBlob(self._requester, data, completed=True)
|
||||
return github.GitBlob.GitBlob(self._requester, headers, data, completed=True)
|
||||
|
||||
def create_git_commit(self, message, tree, parents, author=github.GithubObject.NotSet, committer=github.GithubObject.NotSet):
|
||||
"""
|
||||
@@ -418,7 +419,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return github.GitCommit.GitCommit(self._requester, data, completed=True)
|
||||
return github.GitCommit.GitCommit(self._requester, headers, data, completed=True)
|
||||
|
||||
def create_git_ref(self, ref, sha):
|
||||
"""
|
||||
@@ -439,7 +440,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return github.GitRef.GitRef(self._requester, data, completed=True)
|
||||
return github.GitRef.GitRef(self._requester, headers, data, completed=True)
|
||||
|
||||
def create_git_tag(self, tag, message, object, type, tagger=github.GithubObject.NotSet):
|
||||
"""
|
||||
@@ -470,7 +471,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return github.GitTag.GitTag(self._requester, data, completed=True)
|
||||
return github.GitTag.GitTag(self._requester, headers, data, completed=True)
|
||||
|
||||
def create_git_tree(self, tree, base_tree=github.GithubObject.NotSet):
|
||||
"""
|
||||
@@ -492,7 +493,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return github.GitTree.GitTree(self._requester, data, completed=True)
|
||||
return github.GitTree.GitTree(self._requester, headers, data, completed=True)
|
||||
|
||||
def create_hook(self, name, config, events=github.GithubObject.NotSet, active=github.GithubObject.NotSet):
|
||||
"""
|
||||
@@ -521,7 +522,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return github.Hook.Hook(self._requester, data, completed=True)
|
||||
return github.Hook.Hook(self._requester, headers, data, completed=True)
|
||||
|
||||
def create_issue(self, title, body=github.GithubObject.NotSet, assignee=github.GithubObject.NotSet, milestone=github.GithubObject.NotSet, labels=github.GithubObject.NotSet):
|
||||
"""
|
||||
@@ -555,7 +556,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return github.Issue.Issue(self._requester, data, completed=True)
|
||||
return github.Issue.Issue(self._requester, headers, data, completed=True)
|
||||
|
||||
def create_key(self, title, key):
|
||||
"""
|
||||
@@ -576,7 +577,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return github.RepositoryKey.RepositoryKey(self._requester, data, completed=True, repoUrl=self._url)
|
||||
return github.RepositoryKey.RepositoryKey(self._requester, headers, data, completed=True, repoUrl=self._url)
|
||||
|
||||
def create_label(self, name, color):
|
||||
"""
|
||||
@@ -597,7 +598,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return github.Label.Label(self._requester, data, completed=True)
|
||||
return github.Label.Label(self._requester, headers, data, completed=True)
|
||||
|
||||
def create_milestone(self, title, state=github.GithubObject.NotSet, description=github.GithubObject.NotSet, due_on=github.GithubObject.NotSet):
|
||||
"""
|
||||
@@ -627,7 +628,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return github.Milestone.Milestone(self._requester, data, completed=True)
|
||||
return github.Milestone.Milestone(self._requester, headers, data, completed=True)
|
||||
|
||||
def create_pull(self, *args, **kwds):
|
||||
"""
|
||||
@@ -665,7 +666,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return github.PullRequest.PullRequest(self._requester, data, completed=True)
|
||||
return github.PullRequest.PullRequest(self._requester, headers, data, completed=True)
|
||||
|
||||
def delete(self):
|
||||
"""
|
||||
@@ -770,7 +771,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return github.Branch.Branch(self._requester, data, completed=True)
|
||||
return github.Branch.Branch(self._requester, headers, data, completed=True)
|
||||
|
||||
def get_branches(self):
|
||||
"""
|
||||
@@ -809,7 +810,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return github.CommitComment.CommitComment(self._requester, data, completed=True)
|
||||
return github.CommitComment.CommitComment(self._requester, headers, data, completed=True)
|
||||
|
||||
def get_comments(self):
|
||||
"""
|
||||
@@ -836,7 +837,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return github.Commit.Commit(self._requester, data, completed=True)
|
||||
return github.Commit.Commit(self._requester, headers, data, completed=True)
|
||||
|
||||
def get_commits(self, sha=github.GithubObject.NotSet, path=github.GithubObject.NotSet, since=github.GithubObject.NotSet, until=github.GithubObject.NotSet):
|
||||
"""
|
||||
@@ -894,7 +895,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
url_parameters,
|
||||
None
|
||||
)
|
||||
return github.ContentFile.ContentFile(self._requester, data, completed=True)
|
||||
return github.ContentFile.ContentFile(self._requester, headers, data, completed=True)
|
||||
|
||||
def get_dir_contents(self, path, ref=github.GithubObject.NotSet):
|
||||
"""
|
||||
@@ -925,7 +926,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
)
|
||||
|
||||
return [
|
||||
github.ContentFile.ContentFile(self._requester, attributes, completed=(attributes["type"] != "file")) # Lazy completion only makes sense for files. See discussion here: https://github.com/jacquev6/PyGithub/issues/140#issuecomment-13481130
|
||||
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
|
||||
for attributes in data
|
||||
]
|
||||
|
||||
@@ -954,7 +955,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return github.Download.Download(self._requester, data, completed=True)
|
||||
return github.Download.Download(self._requester, headers, data, completed=True)
|
||||
|
||||
def get_downloads(self):
|
||||
"""
|
||||
@@ -1005,7 +1006,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return github.GitBlob.GitBlob(self._requester, data, completed=True)
|
||||
return github.GitBlob.GitBlob(self._requester, headers, data, completed=True)
|
||||
|
||||
def get_git_commit(self, sha):
|
||||
"""
|
||||
@@ -1020,7 +1021,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return github.GitCommit.GitCommit(self._requester, data, completed=True)
|
||||
return github.GitCommit.GitCommit(self._requester, headers, data, completed=True)
|
||||
|
||||
def get_git_ref(self, ref):
|
||||
"""
|
||||
@@ -1038,7 +1039,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return github.GitRef.GitRef(self._requester, data, completed=True)
|
||||
return github.GitRef.GitRef(self._requester, headers, data, completed=True)
|
||||
|
||||
def get_git_refs(self):
|
||||
"""
|
||||
@@ -1065,7 +1066,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return github.GitTag.GitTag(self._requester, data, completed=True)
|
||||
return github.GitTag.GitTag(self._requester, headers, data, completed=True)
|
||||
|
||||
def get_git_tree(self, sha, recursive=github.GithubObject.NotSet):
|
||||
"""
|
||||
@@ -1085,7 +1086,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
url_parameters,
|
||||
None
|
||||
)
|
||||
return github.GitTree.GitTree(self._requester, data, completed=True)
|
||||
return github.GitTree.GitTree(self._requester, headers, data, completed=True)
|
||||
|
||||
def get_hook(self, id):
|
||||
"""
|
||||
@@ -1100,7 +1101,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return github.Hook.Hook(self._requester, data, completed=True)
|
||||
return github.Hook.Hook(self._requester, headers, data, completed=True)
|
||||
|
||||
def get_hooks(self):
|
||||
"""
|
||||
@@ -1127,7 +1128,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return github.Issue.Issue(self._requester, data, completed=True)
|
||||
return github.Issue.Issue(self._requester, headers, data, completed=True)
|
||||
|
||||
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):
|
||||
"""
|
||||
@@ -1218,7 +1219,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return github.IssueEvent.IssueEvent(self._requester, data, completed=True)
|
||||
return github.IssueEvent.IssueEvent(self._requester, headers, data, completed=True)
|
||||
|
||||
def get_issues_events(self):
|
||||
"""
|
||||
@@ -1245,7 +1246,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return github.RepositoryKey.RepositoryKey(self._requester, data, completed=True, repoUrl=self._url)
|
||||
return github.RepositoryKey.RepositoryKey(self._requester, headers, data, completed=True, repoUrl=self._url)
|
||||
|
||||
def get_keys(self):
|
||||
"""
|
||||
@@ -1253,7 +1254,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.RepositoryKey.RepositoryKey`
|
||||
"""
|
||||
return github.PaginatedList.PaginatedList(
|
||||
lambda requester, data, completed: github.RepositoryKey.RepositoryKey(requester, data, completed, repoUrl=self._url),
|
||||
lambda requester, headers, data, completed: github.RepositoryKey.RepositoryKey(requester, headers, data, completed, repoUrl=self._url),
|
||||
self._requester,
|
||||
self.url + "/keys",
|
||||
None
|
||||
@@ -1272,7 +1273,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return github.Label.Label(self._requester, data, completed=True)
|
||||
return github.Label.Label(self._requester, headers, data, completed=True)
|
||||
|
||||
def get_labels(self):
|
||||
"""
|
||||
@@ -1312,7 +1313,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return github.Milestone.Milestone(self._requester, data, completed=True)
|
||||
return github.Milestone.Milestone(self._requester, headers, data, completed=True)
|
||||
|
||||
def get_milestones(self, state=github.GithubObject.NotSet, sort=github.GithubObject.NotSet, direction=github.GithubObject.NotSet):
|
||||
"""
|
||||
@@ -1364,7 +1365,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return github.PullRequest.PullRequest(self._requester, data, completed=True)
|
||||
return github.PullRequest.PullRequest(self._requester, headers, data, completed=True)
|
||||
|
||||
def get_pulls(self, state=github.GithubObject.NotSet):
|
||||
"""
|
||||
@@ -1434,7 +1435,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
url_parameters,
|
||||
None
|
||||
)
|
||||
return github.ContentFile.ContentFile(self._requester, data, completed=True)
|
||||
return github.ContentFile.ContentFile(self._requester, headers, data, completed=True)
|
||||
|
||||
def get_stargazers(self):
|
||||
"""
|
||||
@@ -1542,7 +1543,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
None
|
||||
)
|
||||
return [
|
||||
github.Issue.Issue(self._requester, github.Legacy.convertIssue(element), completed=False)
|
||||
github.Issue.Issue(self._requester, headers, github.Legacy.convertIssue(element), completed=False)
|
||||
for element in data["issues"]
|
||||
]
|
||||
|
||||
@@ -1572,7 +1573,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
if data is None:
|
||||
return None
|
||||
else:
|
||||
return github.Commit.Commit(self._requester, data, completed=True)
|
||||
return github.Commit.Commit(self._requester, headers, data, completed=True)
|
||||
|
||||
def remove_from_collaborators(self, collaborator):
|
||||
"""
|
||||
@@ -1719,16 +1720,16 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
self._open_issues = attributes["open_issues"]
|
||||
if "organization" in attributes: # pragma no branch
|
||||
assert attributes["organization"] is None or isinstance(attributes["organization"], dict), attributes["organization"]
|
||||
self._organization = None if attributes["organization"] is None else github.Organization.Organization(self._requester, attributes["organization"], completed=False)
|
||||
self._organization = None if attributes["organization"] is None else github.Organization.Organization(self._requester, self._headers, attributes["organization"], completed=False)
|
||||
if "owner" in attributes: # pragma no branch
|
||||
assert attributes["owner"] is None or isinstance(attributes["owner"], dict), attributes["owner"]
|
||||
self._owner = None if attributes["owner"] is None else github.NamedUser.NamedUser(self._requester, attributes["owner"], completed=False)
|
||||
self._owner = None if attributes["owner"] is None else github.NamedUser.NamedUser(self._requester, self._headers, attributes["owner"], completed=False)
|
||||
if "parent" in attributes: # pragma no branch
|
||||
assert attributes["parent"] is None or isinstance(attributes["parent"], dict), attributes["parent"]
|
||||
self._parent = None if attributes["parent"] is None else Repository(self._requester, attributes["parent"], completed=False)
|
||||
self._parent = None if attributes["parent"] is None else Repository(self._requester, self._headers, attributes["parent"], completed=False)
|
||||
if "permissions" in attributes: # pragma no branch
|
||||
assert attributes["permissions"] is None or isinstance(attributes["permissions"], dict), attributes["permissions"]
|
||||
self._permissions = None if attributes["permissions"] is None else github.Permissions.Permissions(self._requester, attributes["permissions"], completed=False)
|
||||
self._permissions = None if attributes["permissions"] is None else github.Permissions.Permissions(self._requester, self._headers, attributes["permissions"], completed=False)
|
||||
if "private" in attributes: # pragma no branch
|
||||
assert attributes["private"] is None or isinstance(attributes["private"], bool), attributes["private"]
|
||||
self._private = attributes["private"]
|
||||
@@ -1740,7 +1741,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
self._size = attributes["size"]
|
||||
if "source" in attributes: # pragma no branch
|
||||
assert attributes["source"] is None or isinstance(attributes["source"], dict), attributes["source"]
|
||||
self._source = None if attributes["source"] is None else Repository(self._requester, attributes["source"], completed=False)
|
||||
self._source = None if attributes["source"] is None else Repository(self._requester, self._headers, attributes["source"], completed=False)
|
||||
if "ssh_url" in attributes: # pragma no branch
|
||||
assert attributes["ssh_url"] is None or isinstance(attributes["ssh_url"], (str, unicode)), attributes["ssh_url"]
|
||||
self._ssh_url = attributes["ssh_url"]
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Srijan Choudhary <srijan4@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2013 martinqt <m.ki2@laposte.net> #
|
||||
@@ -33,8 +34,8 @@ class RepositoryKey(github.GithubObject.CompletableGithubObject):
|
||||
This class represents RepositoryKeys. The reference can be found here http://developer.github.com/v3/repos/keys/
|
||||
"""
|
||||
|
||||
def __init__(self, requester, attributes, completed, repoUrl):
|
||||
github.GithubObject.CompletableGithubObject.__init__(self, requester, attributes, completed)
|
||||
def __init__(self, requester, headers, attributes, completed, repoUrl):
|
||||
github.GithubObject.CompletableGithubObject.__init__(self, requester, headers, attributes, completed)
|
||||
self.__repoUrl = repoUrl
|
||||
|
||||
@property
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
# Copyright 2012 Steve English <steve.english@navetas.com> #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Ed Jackson <ed.jackson@gmail.com> #
|
||||
# Copyright 2013 Jonathan J Hunt <hunt@braincorporation.com> #
|
||||
# Copyright 2013 Mark Roddy <markroddy@gmail.com> #
|
||||
@@ -63,7 +64,70 @@ class Requester:
|
||||
cls.__httpConnectionClass = httplib.HTTPConnection
|
||||
cls.__httpsConnectionClass = httplib.HTTPSConnection
|
||||
|
||||
#############################################################
|
||||
# For Debug
|
||||
@classmethod
|
||||
def setDebugFlag(cls, flag):
|
||||
cls.DEBUG_FLAG = flag
|
||||
|
||||
@classmethod
|
||||
def setOnCheckMe(cls, onCheckMe):
|
||||
cls.ON_CHECK_ME = onCheckMe
|
||||
|
||||
DEBUG_FLAG = False
|
||||
|
||||
DEBUG_FRAME_BUFFER_SIZE = 1024
|
||||
|
||||
DEBUG_HEADER_KEY = "DEBUG_FRAME"
|
||||
|
||||
ON_CHECK_ME = None
|
||||
|
||||
def NEW_DEBUG_FRAME(self, requestHeader):
|
||||
'''
|
||||
Initialize a debug frame with requestHeader
|
||||
Frame count is updated and will be attached to respond header
|
||||
The structure of a frame: [requestHeader, statusCode, responseHeader, raw_data]
|
||||
Some of them may be None
|
||||
'''
|
||||
if not self.DEBUG_FLAG:
|
||||
return
|
||||
|
||||
new_frame = [requestHeader, None, None, None]
|
||||
if self._frameCount < self.DEBUG_FRAME_BUFFER_SIZE - 1:
|
||||
self._frameBuffer.append(new_frame)
|
||||
else:
|
||||
self._frameBuffer[0] = new_frame
|
||||
|
||||
self._frameCount = len(self._frameBuffer) - 1
|
||||
|
||||
def DEBUG_ON_RESPONSE(self, statusCode, responseHeader, data):
|
||||
'''
|
||||
Update current frame with response
|
||||
Current frame index will be attached to responseHeader
|
||||
'''
|
||||
if not self.DEBUG_FLAG:
|
||||
return
|
||||
|
||||
self._frameBuffer[self._frameCount][1:4] = [statusCode, responseHeader, data]
|
||||
responseHeader[self.DEBUG_HEADER_KEY] = self._frameCount
|
||||
|
||||
def check_me(self, obj):
|
||||
if self.DEBUG_FLAG and self.ON_CHECK_ME is not None:
|
||||
frame = None
|
||||
if self.DEBUG_HEADER_KEY in obj._headers:
|
||||
frame_index = obj._headers[self.DEBUG_HEADER_KEY]
|
||||
frame = self._frameBuffer[frame_index]
|
||||
self.ON_CHECK_ME(obj, frame)
|
||||
|
||||
def _initializeDebugFeature(self):
|
||||
self._frameCount = 0
|
||||
self._frameBuffer = []
|
||||
|
||||
#############################################################
|
||||
|
||||
def __init__(self, login_or_token, password, base_url, timeout, client_id, client_secret, user_agent, per_page):
|
||||
self._initializeDebugFeature()
|
||||
|
||||
if password is not None:
|
||||
login = login_or_token
|
||||
if atLeastPython3:
|
||||
@@ -111,6 +175,9 @@ class Requester:
|
||||
|
||||
def __check(self, status, responseHeaders, output):
|
||||
output = self.__structuredFromJson(output)
|
||||
# Log frame
|
||||
self.DEBUG_ON_RESPONSE(status, responseHeaders, output)
|
||||
|
||||
if status >= 400:
|
||||
raise self.__createException(status, output)
|
||||
return responseHeaders, output
|
||||
@@ -177,6 +244,8 @@ class Requester:
|
||||
if input is not None:
|
||||
requestHeaders["Content-Type"], encoded_input = encode(input)
|
||||
|
||||
self.NEW_DEBUG_FRAME(requestHeaders)
|
||||
|
||||
status, responseHeaders, output = self.__requestRaw(verb, url, requestHeaders, encoded_input)
|
||||
|
||||
if "x-ratelimit-remaining" in responseHeaders and "x-ratelimit-limit" in responseHeaders:
|
||||
|
||||
+2
-1
@@ -4,6 +4,7 @@
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2013 martinqt <m.ki2@laposte.net> #
|
||||
# #
|
||||
@@ -71,7 +72,7 @@ class Tag(github.GithubObject.NonCompletableGithubObject):
|
||||
def _useAttributes(self, attributes):
|
||||
if "commit" in attributes: # pragma no branch
|
||||
assert attributes["commit"] is None or isinstance(attributes["commit"], dict), attributes["commit"]
|
||||
self._commit = None if attributes["commit"] is None else github.Commit.Commit(self._requester, attributes["commit"], completed=False)
|
||||
self._commit = None if attributes["commit"] is None else github.Commit.Commit(self._requester, self._headers, attributes["commit"], completed=False)
|
||||
if "name" in attributes: # pragma no branch
|
||||
assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"]
|
||||
self._name = attributes["name"]
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2013 martinqt <m.ki2@laposte.net> #
|
||||
# #
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2013 martinqt <m.ki2@laposte.net> #
|
||||
# #
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
# #
|
||||
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2012 Zearin <zearin@gonk.net> #
|
||||
# Copyright 2013 AKFish <akfish@gmail.com> #
|
||||
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# #
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
|
||||
@@ -244,8 +245,24 @@ class BasicTestCase(unittest.TestCase):
|
||||
|
||||
|
||||
class TestCase(BasicTestCase):
|
||||
def doCheckFrame(self, obj, frame):
|
||||
if obj._headers == {} and frame is None:
|
||||
return
|
||||
if obj._headers is None and frame == {}:
|
||||
return
|
||||
self.assertEqual(obj._headers, frame[2])
|
||||
|
||||
def getFrameChecker(self):
|
||||
return lambda requester, obj, frame: self.doCheckFrame(obj, frame)
|
||||
|
||||
def setUp(self):
|
||||
BasicTestCase.setUp(self)
|
||||
|
||||
# Set up frame debugging
|
||||
github.GithubObject.GithubObject.setCheckAfterInitFlag(True)
|
||||
github.Requester.Requester.setDebugFlag(True)
|
||||
github.Requester.Requester.setOnCheckMe(self.getFrameChecker())
|
||||
|
||||
self.g = github.Github(self.login, self.password)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user