diff --git a/github/Branch.py b/github/Branch.py index 11f074d5..6e9f094f 100644 --- a/github/Branch.py +++ b/github/Branch.py @@ -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): diff --git a/github/CommitStats.py b/github/CommitStats.py index 1be6a1d4..ce367f48 100644 --- a/github/CommitStats.py +++ b/github/CommitStats.py @@ -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): diff --git a/github/CommitStatus.py b/github/CommitStatus.py index 122c55c4..b870cd30 100644 --- a/github/CommitStatus.py +++ b/github/CommitStatus.py @@ -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): diff --git a/github/Event.py b/github/Event.py index 60e7c863..bf185c4a 100644 --- a/github/Event.py +++ b/github/Event.py @@ -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): diff --git a/github/File.py b/github/File.py index 538fde6b..e126bac0 100644 --- a/github/File.py +++ b/github/File.py @@ -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): diff --git a/github/GistFile.py b/github/GistFile.py index a153c7ba..458fd87e 100644 --- a/github/GistFile.py +++ b/github/GistFile.py @@ -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): diff --git a/github/GitAuthor.py b/github/GitAuthor.py index dd409dea..71d3b3c1 100644 --- a/github/GitAuthor.py +++ b/github/GitAuthor.py @@ -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): diff --git a/github/GitObject.py b/github/GitObject.py index 2d29b437..2d18d850 100644 --- a/github/GitObject.py +++ b/github/GitObject.py @@ -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): diff --git a/github/GitTreeElement.py b/github/GitTreeElement.py index bf361be0..f58b57b3 100644 --- a/github/GitTreeElement.py +++ b/github/GitTreeElement.py @@ -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): diff --git a/github/GithubObject.py b/github/GithubObject.py index ba1feba7..4289a445 100644 --- a/github/GithubObject.py +++ b/github/GithubObject.py @@ -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 diff --git a/github/GitignoreTemplate.py b/github/GitignoreTemplate.py index a1b96d7c..82b6def9 100644 --- a/github/GitignoreTemplate.py +++ b/github/GitignoreTemplate.py @@ -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): diff --git a/github/HookDescription.py b/github/HookDescription.py index 766cbfc7..3a665159 100644 --- a/github/HookDescription.py +++ b/github/HookDescription.py @@ -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): diff --git a/github/HookResponse.py b/github/HookResponse.py index 87dc0ac0..8b3b0183 100644 --- a/github/HookResponse.py +++ b/github/HookResponse.py @@ -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): diff --git a/github/IssuePullRequest.py b/github/IssuePullRequest.py index cdc1b44b..075b61ce 100644 --- a/github/IssuePullRequest.py +++ b/github/IssuePullRequest.py @@ -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): diff --git a/github/NotificationSubject.py b/github/NotificationSubject.py index d32977ea..4188e059 100644 --- a/github/NotificationSubject.py +++ b/github/NotificationSubject.py @@ -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): diff --git a/github/PaginatedList.py b/github/PaginatedList.py index 21de4ed4..effdb839 100644 --- a/github/PaginatedList.py +++ b/github/PaginatedList.py @@ -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) diff --git a/github/Permissions.py b/github/Permissions.py index 8b9f3b39..3a346d76 100644 --- a/github/Permissions.py +++ b/github/Permissions.py @@ -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): diff --git a/github/Plan.py b/github/Plan.py index 1daefc7c..638369b3 100644 --- a/github/Plan.py +++ b/github/Plan.py @@ -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): diff --git a/github/PullRequestMergeStatus.py b/github/PullRequestMergeStatus.py index f9bae790..7151b21f 100644 --- a/github/PullRequestMergeStatus.py +++ b/github/PullRequestMergeStatus.py @@ -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): diff --git a/github/PullRequestPart.py b/github/PullRequestPart.py index 99778645..4a05fecc 100644 --- a/github/PullRequestPart.py +++ b/github/PullRequestPart.py @@ -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): diff --git a/github/Tag.py b/github/Tag.py index 5a42f637..0b185f11 100644 --- a/github/Tag.py +++ b/github/Tag.py @@ -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):