mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-02 11:51:10 +00:00
Change NonCompletableGithubObject without breaking build.
This commit is contained in:
@@ -33,6 +33,11 @@ class Branch(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents Branchs. The reference can be found here http://developer.github.com/v3/repos/#list-branches
|
||||
"""
|
||||
def __init__(self, requester, attributes, completed):
|
||||
'''
|
||||
Adapte for __init__ change, remove later
|
||||
'''
|
||||
github.GithubObject.NonCompletableGithubObject.__init__(self, requester, {}, attributes, completed)
|
||||
|
||||
@property
|
||||
def commit(self):
|
||||
|
||||
@@ -30,6 +30,11 @@ class CommitStats(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents CommitStatss as returned for example by http://developer.github.com/v3/todo
|
||||
"""
|
||||
def __init__(self, requester, attributes, completed):
|
||||
'''
|
||||
Adapte for __init__ change, remove later
|
||||
'''
|
||||
github.GithubObject.NonCompletableGithubObject.__init__(self, requester, {}, attributes, completed)
|
||||
|
||||
@property
|
||||
def additions(self):
|
||||
|
||||
@@ -32,6 +32,11 @@ class CommitStatus(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents CommitStatuss as returned for example by http://developer.github.com/v3/todo
|
||||
"""
|
||||
def __init__(self, requester, attributes, completed):
|
||||
'''
|
||||
Adapte for __init__ change, remove later
|
||||
'''
|
||||
github.GithubObject.NonCompletableGithubObject.__init__(self, requester, {}, attributes, completed)
|
||||
|
||||
@property
|
||||
def created_at(self):
|
||||
|
||||
@@ -35,6 +35,11 @@ class Event(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents Events. The reference can be found here http://developer.github.com/v3/activity/events/
|
||||
"""
|
||||
def __init__(self, requester, attributes, completed):
|
||||
'''
|
||||
Adapte for __init__ change, remove later
|
||||
'''
|
||||
github.GithubObject.NonCompletableGithubObject.__init__(self, requester, {}, attributes, completed)
|
||||
|
||||
@property
|
||||
def actor(self):
|
||||
|
||||
@@ -30,6 +30,11 @@ class File(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents Files as returned for example by http://developer.github.com/v3/todo
|
||||
"""
|
||||
def __init__(self, requester, attributes, completed):
|
||||
'''
|
||||
Adapte for __init__ change, remove later
|
||||
'''
|
||||
github.GithubObject.NonCompletableGithubObject.__init__(self, requester, {}, attributes, completed)
|
||||
|
||||
@property
|
||||
def additions(self):
|
||||
|
||||
@@ -30,6 +30,11 @@ class GistFile(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents GistFiles as returned for example by http://developer.github.com/v3/todo
|
||||
"""
|
||||
def __init__(self, requester, attributes, completed):
|
||||
'''
|
||||
Adapte for __init__ change, remove later
|
||||
'''
|
||||
github.GithubObject.NonCompletableGithubObject.__init__(self, requester, {}, attributes, completed)
|
||||
|
||||
@property
|
||||
def content(self):
|
||||
|
||||
@@ -30,6 +30,11 @@ class GitAuthor(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents GitAuthors as returned for example by http://developer.github.com/v3/todo
|
||||
"""
|
||||
def __init__(self, requester, attributes, completed):
|
||||
'''
|
||||
Adapte for __init__ change, remove later
|
||||
'''
|
||||
github.GithubObject.NonCompletableGithubObject.__init__(self, requester, {}, attributes, completed)
|
||||
|
||||
@property
|
||||
def date(self):
|
||||
|
||||
@@ -30,6 +30,11 @@ class GitObject(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents GitObjects as returned for example by http://developer.github.com/v3/todo
|
||||
"""
|
||||
def __init__(self, requester, attributes, completed):
|
||||
'''
|
||||
Adapte for __init__ change, remove later
|
||||
'''
|
||||
github.GithubObject.NonCompletableGithubObject.__init__(self, requester, {}, attributes, completed)
|
||||
|
||||
@property
|
||||
def sha(self):
|
||||
|
||||
@@ -30,6 +30,11 @@ class GitTreeElement(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents GitTreeElements as returned for example by http://developer.github.com/v3/todo
|
||||
"""
|
||||
def __init__(self, requester, attributes, completed):
|
||||
'''
|
||||
Adapte for __init__ change, remove later
|
||||
'''
|
||||
github.GithubObject.NonCompletableGithubObject.__init__(self, requester, {}, attributes, completed)
|
||||
|
||||
@property
|
||||
def mode(self):
|
||||
|
||||
@@ -80,17 +80,18 @@ class GithubObject(object):
|
||||
|
||||
|
||||
class NonCompletableGithubObject(GithubObject):
|
||||
def __init__(self, requester, attributes, completed):
|
||||
'''
|
||||
Adapte for __init__ change, remove later
|
||||
'''
|
||||
GithubObject.__init__(self, requester, {}, attributes, completed)
|
||||
# def __init__(self, requester, attributes, completed):
|
||||
# '''
|
||||
# Adapte for __init__ change, remove later
|
||||
# '''
|
||||
# GithubObject.__init__(self, requester, {}, attributes, completed)
|
||||
def _completeIfNeeded(self):
|
||||
pass
|
||||
|
||||
|
||||
class CompletableGithubObject(GithubObject):
|
||||
def __init__(self, requester, attributes, completed):
|
||||
# Adapte for __init__ change, remove later
|
||||
GithubObject.__init__(self, requester, {}, attributes, completed)
|
||||
self.__completed = completed
|
||||
|
||||
|
||||
@@ -29,6 +29,11 @@ class GitignoreTemplate(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents GitignoreTemplates as returned for example by http://developer.github.com/v3/todo
|
||||
"""
|
||||
def __init__(self, requester, attributes, completed):
|
||||
'''
|
||||
Adapte for __init__ change, remove later
|
||||
'''
|
||||
github.GithubObject.NonCompletableGithubObject.__init__(self, requester, {}, attributes, completed)
|
||||
|
||||
@property
|
||||
def source(self):
|
||||
|
||||
@@ -30,6 +30,11 @@ class HookDescription(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents HookDescriptions as returned for example by http://developer.github.com/v3/todo
|
||||
"""
|
||||
def __init__(self, requester, attributes, completed):
|
||||
'''
|
||||
Adapte for __init__ change, remove later
|
||||
'''
|
||||
github.GithubObject.NonCompletableGithubObject.__init__(self, requester, {}, attributes, completed)
|
||||
|
||||
@property
|
||||
def events(self):
|
||||
|
||||
@@ -30,6 +30,11 @@ class HookResponse(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents HookResponses as returned for example by http://developer.github.com/v3/todo
|
||||
"""
|
||||
def __init__(self, requester, attributes, completed):
|
||||
'''
|
||||
Adapte for __init__ change, remove later
|
||||
'''
|
||||
github.GithubObject.NonCompletableGithubObject.__init__(self, requester, {}, attributes, completed)
|
||||
|
||||
@property
|
||||
def code(self):
|
||||
|
||||
@@ -30,6 +30,11 @@ class IssuePullRequest(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents IssuePullRequests as returned for example by http://developer.github.com/v3/todo
|
||||
"""
|
||||
def __init__(self, requester, attributes, completed):
|
||||
'''
|
||||
Adapte for __init__ change, remove later
|
||||
'''
|
||||
github.GithubObject.NonCompletableGithubObject.__init__(self, requester, {}, attributes, completed)
|
||||
|
||||
@property
|
||||
def diff_url(self):
|
||||
|
||||
@@ -28,6 +28,11 @@ class NotificationSubject(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents Subjects of Notifications as returned for example by http://developer.github.com/v3/activity/notifications/#list-your-notifications
|
||||
"""
|
||||
def __init__(self, requester, attributes, completed):
|
||||
'''
|
||||
Adapte for __init__ change, remove later
|
||||
'''
|
||||
github.GithubObject.NonCompletableGithubObject.__init__(self, requester, {}, attributes, completed)
|
||||
|
||||
@property
|
||||
def title(self):
|
||||
|
||||
+25
-9
@@ -26,7 +26,7 @@
|
||||
################################################################################
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
import inspect
|
||||
|
||||
class PaginatedListBase:
|
||||
def __init__(self):
|
||||
@@ -113,6 +113,28 @@ class PaginatedList(PaginatedListBase):
|
||||
|
||||
def _couldGrow(self):
|
||||
return self.__nextUrl is not None
|
||||
|
||||
def makePage(self, headers, data):
|
||||
'''
|
||||
Adapte for diffrent __init__ signature in refactoring, remove when done
|
||||
'''
|
||||
try:
|
||||
if not inspect.isclass(self.__contentClass):
|
||||
return [
|
||||
self.__contentClass(self.__requester, element, completed=False)
|
||||
for element in data]
|
||||
elif issubclass(self.__contentClass, github.GithubObject.NonCompletableGithubObject):
|
||||
return [
|
||||
self.__contentClass(self.__requester, element, completed=False)
|
||||
for element in data]
|
||||
else:
|
||||
return [
|
||||
self.__contentClass(self.__requester, element, completed=False)
|
||||
for element in data]
|
||||
except TypeError: # fix for some testcases, passed lambda in
|
||||
print "WTF????????????????"
|
||||
print self.__contentClass
|
||||
raise
|
||||
|
||||
def _fetchNextPage(self):
|
||||
headers, data = self.__requester.requestJsonAndCheck("GET", self.__nextUrl, self.__nextParams, None)
|
||||
@@ -124,10 +146,7 @@ class PaginatedList(PaginatedListBase):
|
||||
self.__nextUrl = None
|
||||
self.__nextParams = None
|
||||
|
||||
return [
|
||||
self.__contentClass(self.__requester, element, completed=False)
|
||||
for element in data
|
||||
]
|
||||
return self.makePage(headers, data)
|
||||
|
||||
def __parseLinkHeader(self, headers):
|
||||
links = {}
|
||||
@@ -148,7 +167,4 @@ class PaginatedList(PaginatedListBase):
|
||||
params["per_page"] = self.__requester.per_page
|
||||
headers, data = self.__requester.requestJsonAndCheck("GET", self.__firstUrl, params, None)
|
||||
|
||||
return [
|
||||
self.__contentClass(self.__requester, element, completed=False)
|
||||
for element in data
|
||||
]
|
||||
return self.makePage(headers, data)
|
||||
|
||||
@@ -30,6 +30,11 @@ class Permissions(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents Permissionss as returned for example by http://developer.github.com/v3/todo
|
||||
"""
|
||||
def __init__(self, requester, attributes, completed):
|
||||
'''
|
||||
Adapte for __init__ change, remove later
|
||||
'''
|
||||
github.GithubObject.NonCompletableGithubObject.__init__(self, requester, {}, attributes, completed)
|
||||
|
||||
@property
|
||||
def admin(self):
|
||||
|
||||
@@ -30,6 +30,11 @@ class Plan(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents Plans as returned for example by http://developer.github.com/v3/todo
|
||||
"""
|
||||
def __init__(self, requester, attributes, completed):
|
||||
'''
|
||||
Adapte for __init__ change, remove later
|
||||
'''
|
||||
github.GithubObject.NonCompletableGithubObject.__init__(self, requester, {}, attributes, completed)
|
||||
|
||||
@property
|
||||
def collaborators(self):
|
||||
|
||||
@@ -31,6 +31,11 @@ class PullRequestMergeStatus(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents PullRequestMergeStatuss. The reference can be found here http://developer.github.com/v3/pulls/#get-if-a-pull-request-has-been-merged
|
||||
"""
|
||||
def __init__(self, requester, attributes, completed):
|
||||
'''
|
||||
Adapte for __init__ change, remove later
|
||||
'''
|
||||
github.GithubObject.NonCompletableGithubObject.__init__(self, requester, {}, attributes, completed)
|
||||
|
||||
@property
|
||||
def merged(self):
|
||||
|
||||
@@ -33,6 +33,11 @@ class PullRequestPart(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents PullRequestParts as returned for example by http://developer.github.com/v3/todo
|
||||
"""
|
||||
def __init__(self, requester, attributes, completed):
|
||||
'''
|
||||
Adapte for __init__ change, remove later
|
||||
'''
|
||||
github.GithubObject.NonCompletableGithubObject.__init__(self, requester, {}, attributes, completed)
|
||||
|
||||
@property
|
||||
def label(self):
|
||||
|
||||
@@ -33,6 +33,11 @@ class Tag(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents Tags. The reference can be found here http://developer.github.com/v3/git/tags/
|
||||
"""
|
||||
def __init__(self, requester, attributes, completed):
|
||||
'''
|
||||
Adapte for __init__ change, remove later
|
||||
'''
|
||||
github.GithubObject.NonCompletableGithubObject.__init__(self, requester, {}, attributes, completed)
|
||||
|
||||
@property
|
||||
def commit(self):
|
||||
|
||||
Reference in New Issue
Block a user