diff --git a/CodeGenerator/templates/GithubObject.MethodBody.UseResult.py b/CodeGenerator/templates/GithubObject.MethodBody.UseResult.py index 667fba13..c241ce56 100644 --- a/CodeGenerator/templates/GithubObject.MethodBody.UseResult.py +++ b/CodeGenerator/templates/GithubObject.MethodBody.UseResult.py @@ -23,10 +23,12 @@ {% endif %} {% if method.type.cardinality == "list" %} - return [ - {% if method.type.name != class.name %}{{ method.type.name }}.{% endif %}{{ method.type.name }}( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + {% if method.type.name != class.name %}{{ method.type.name }}.{% endif %}{{ method.type.name }}, + self.__requester, + headers, + data + ) {% endif %} {% endif %} diff --git a/CodeGenerator/templates/GithubObject.py b/CodeGenerator/templates/GithubObject.py index 631327bc..1f28c7e0 100644 --- a/CodeGenerator/templates/GithubObject.py +++ b/CodeGenerator/templates/GithubObject.py @@ -1,3 +1,5 @@ +import PaginatedList + {% for dependency in class.dependencies %} import {{ dependency }} {% endfor %} diff --git a/IntegrationTest.py b/IntegrationTest.py index 150d6c2a..ed46149f 100644 --- a/IntegrationTest.py +++ b/IntegrationTest.py @@ -619,7 +619,8 @@ class IntegrationTest: self.printList( "Emails", u.get_emails() ) def printList( self, title, iterable, f = lambda x: x ): - print title + ":", ", ".join( str( f( x ) ) for x in iterable[ :10 ] ), "..." if len( iterable ) > 10 else "" + printed = list( iterable ) + print title + ":", ", ".join( str( f( x ) ) for x in printed[ :10 ] ), "..." if len( printed ) > 10 else "" sys.setrecursionlimit( 50 ) IntegrationTest().main( sys.argv[ 1: ] ) diff --git a/github/GithubObjects/AuthenticatedUser.py b/github/GithubObjects/AuthenticatedUser.py index 44983b65..84535acd 100644 --- a/github/GithubObjects/AuthenticatedUser.py +++ b/github/GithubObjects/AuthenticatedUser.py @@ -1,6 +1,7 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import PaginatedList import Gist import Repository import NamedUser @@ -295,10 +296,12 @@ class AuthenticatedUser( object ): None, None ) - return [ - Authorization.Authorization( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + Authorization.Authorization, + self.__requester, + headers, + data + ) def get_emails( self ): status, headers, data = self.__requester.request( @@ -316,10 +319,12 @@ class AuthenticatedUser( object ): None, None ) - return [ - Event.Event( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + Event.Event, + self.__requester, + headers, + data + ) def get_followers( self ): status, headers, data = self.__requester.request( @@ -328,10 +333,12 @@ class AuthenticatedUser( object ): None, None ) - return [ - NamedUser.NamedUser( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + NamedUser.NamedUser, + self.__requester, + headers, + data + ) def get_following( self ): status, headers, data = self.__requester.request( @@ -340,10 +347,12 @@ class AuthenticatedUser( object ): None, None ) - return [ - NamedUser.NamedUser( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + NamedUser.NamedUser, + self.__requester, + headers, + data + ) def get_gists( self ): status, headers, data = self.__requester.request( @@ -352,10 +361,12 @@ class AuthenticatedUser( object ): None, None ) - return [ - Gist.Gist( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + Gist.Gist, + self.__requester, + headers, + data + ) def get_issues( self ): status, headers, data = self.__requester.request( @@ -364,10 +375,12 @@ class AuthenticatedUser( object ): None, None ) - return [ - Issue.Issue( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + Issue.Issue, + self.__requester, + headers, + data + ) def get_key( self, id ): status, headers, data = self.__requester.request( @@ -385,10 +398,12 @@ class AuthenticatedUser( object ): None, None ) - return [ - UserKey.UserKey( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + UserKey.UserKey, + self.__requester, + headers, + data + ) def get_organization_events( self, org ): pass @@ -400,10 +415,12 @@ class AuthenticatedUser( object ): None, None ) - return [ - Organization.Organization( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + Organization.Organization, + self.__requester, + headers, + data + ) def get_repo( self, name ): status, headers, data = self.__requester.request( @@ -421,10 +438,12 @@ class AuthenticatedUser( object ): None, None ) - return [ - Repository.Repository( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + Repository.Repository, + self.__requester, + headers, + data + ) def get_starred_gists( self ): pass @@ -436,10 +455,12 @@ class AuthenticatedUser( object ): None, None ) - return [ - Repository.Repository( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + Repository.Repository, + self.__requester, + headers, + data + ) def has_in_following( self, following ): status, headers, data = self.__requester.request( diff --git a/github/GithubObjects/Authorization.py b/github/GithubObjects/Authorization.py index 26f29bd8..97b0a483 100644 --- a/github/GithubObjects/Authorization.py +++ b/github/GithubObjects/Authorization.py @@ -1,6 +1,7 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import PaginatedList # This allows None as a valid value for an optional parameter class DefaultValueForOptionalParametersType: diff --git a/github/GithubObjects/Branch.py b/github/GithubObjects/Branch.py index 296546a7..07f13df7 100644 --- a/github/GithubObjects/Branch.py +++ b/github/GithubObjects/Branch.py @@ -1,6 +1,7 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import PaginatedList import Commit # This allows None as a valid value for an optional parameter diff --git a/github/GithubObjects/Commit.py b/github/GithubObjects/Commit.py index c333a8ba..7fb6bfa4 100644 --- a/github/GithubObjects/Commit.py +++ b/github/GithubObjects/Commit.py @@ -1,6 +1,7 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import PaginatedList import NamedUser import GitCommit import CommitComment @@ -86,10 +87,12 @@ class Commit( object ): None, None ) - return [ - CommitComment.CommitComment( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + CommitComment.CommitComment, + self.__requester, + headers, + data + ) def __initAttributes( self ): self.__author = None diff --git a/github/GithubObjects/CommitComment.py b/github/GithubObjects/CommitComment.py index 45a0f891..d15db258 100644 --- a/github/GithubObjects/CommitComment.py +++ b/github/GithubObjects/CommitComment.py @@ -1,6 +1,7 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import PaginatedList import NamedUser # This allows None as a valid value for an optional parameter diff --git a/github/GithubObjects/Download.py b/github/GithubObjects/Download.py index ad68d8b4..00f0255f 100644 --- a/github/GithubObjects/Download.py +++ b/github/GithubObjects/Download.py @@ -1,6 +1,7 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import PaginatedList # This allows None as a valid value for an optional parameter class DefaultValueForOptionalParametersType: diff --git a/github/GithubObjects/Event.py b/github/GithubObjects/Event.py index 20ff2526..a5112ead 100644 --- a/github/GithubObjects/Event.py +++ b/github/GithubObjects/Event.py @@ -1,6 +1,7 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import PaginatedList import Organization import Repository import NamedUser diff --git a/github/GithubObjects/Gist.py b/github/GithubObjects/Gist.py index 41c66dde..7831a069 100644 --- a/github/GithubObjects/Gist.py +++ b/github/GithubObjects/Gist.py @@ -1,6 +1,7 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import PaginatedList import NamedUser import Gist import GistComment @@ -143,10 +144,12 @@ class Gist( object ): None, None ) - return [ - GistComment.GistComment( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + GistComment.GistComment, + self.__requester, + headers, + data + ) def is_starred( self ): pass diff --git a/github/GithubObjects/GistComment.py b/github/GithubObjects/GistComment.py index 0a2b8f33..7ae90cbc 100644 --- a/github/GithubObjects/GistComment.py +++ b/github/GithubObjects/GistComment.py @@ -1,6 +1,7 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import PaginatedList import NamedUser # This allows None as a valid value for an optional parameter diff --git a/github/GithubObjects/GitBlob.py b/github/GithubObjects/GitBlob.py index 5b5cf483..43150368 100644 --- a/github/GithubObjects/GitBlob.py +++ b/github/GithubObjects/GitBlob.py @@ -1,6 +1,7 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import PaginatedList # This allows None as a valid value for an optional parameter class DefaultValueForOptionalParametersType: diff --git a/github/GithubObjects/GitCommit.py b/github/GithubObjects/GitCommit.py index 7ae49011..45ef0241 100644 --- a/github/GithubObjects/GitCommit.py +++ b/github/GithubObjects/GitCommit.py @@ -1,6 +1,7 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import PaginatedList import GitTree # This allows None as a valid value for an optional parameter diff --git a/github/GithubObjects/GitRef.py b/github/GithubObjects/GitRef.py index 19bb7002..e4aad4b3 100644 --- a/github/GithubObjects/GitRef.py +++ b/github/GithubObjects/GitRef.py @@ -1,6 +1,7 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import PaginatedList # This allows None as a valid value for an optional parameter class DefaultValueForOptionalParametersType: diff --git a/github/GithubObjects/GitTag.py b/github/GithubObjects/GitTag.py index 0b781117..b9dd9c42 100644 --- a/github/GithubObjects/GitTag.py +++ b/github/GithubObjects/GitTag.py @@ -1,6 +1,7 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import PaginatedList # This allows None as a valid value for an optional parameter class DefaultValueForOptionalParametersType: diff --git a/github/GithubObjects/GitTree.py b/github/GithubObjects/GitTree.py index 3fafcc75..1b135bdc 100644 --- a/github/GithubObjects/GitTree.py +++ b/github/GithubObjects/GitTree.py @@ -1,6 +1,7 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import PaginatedList # This allows None as a valid value for an optional parameter class DefaultValueForOptionalParametersType: diff --git a/github/GithubObjects/Hook.py b/github/GithubObjects/Hook.py index e99133c6..42f1ff83 100644 --- a/github/GithubObjects/Hook.py +++ b/github/GithubObjects/Hook.py @@ -1,6 +1,7 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import PaginatedList # This allows None as a valid value for an optional parameter class DefaultValueForOptionalParametersType: diff --git a/github/GithubObjects/Issue.py b/github/GithubObjects/Issue.py index 052e2e4e..458e08e5 100644 --- a/github/GithubObjects/Issue.py +++ b/github/GithubObjects/Issue.py @@ -1,6 +1,7 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import PaginatedList import IssueComment import IssueEvent import NamedUser @@ -169,10 +170,12 @@ class Issue( object ): None, None ) - return [ - IssueComment.IssueComment( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + IssueComment.IssueComment, + self.__requester, + headers, + data + ) def get_events( self ): status, headers, data = self.__requester.request( @@ -181,10 +184,12 @@ class Issue( object ): None, None ) - return [ - IssueEvent.IssueEvent( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + IssueEvent.IssueEvent, + self.__requester, + headers, + data + ) def get_labels( self ): status, headers, data = self.__requester.request( @@ -193,10 +198,12 @@ class Issue( object ): None, None ) - return [ - Label.Label( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + Label.Label, + self.__requester, + headers, + data + ) def remove_from_labels( self, label ): status, headers, data = self.__requester.request( diff --git a/github/GithubObjects/IssueComment.py b/github/GithubObjects/IssueComment.py index 2819386c..752a779a 100644 --- a/github/GithubObjects/IssueComment.py +++ b/github/GithubObjects/IssueComment.py @@ -1,6 +1,7 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import PaginatedList import NamedUser # This allows None as a valid value for an optional parameter diff --git a/github/GithubObjects/IssueEvent.py b/github/GithubObjects/IssueEvent.py index e84c42d8..242e6a7e 100644 --- a/github/GithubObjects/IssueEvent.py +++ b/github/GithubObjects/IssueEvent.py @@ -1,6 +1,7 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import PaginatedList import NamedUser # This allows None as a valid value for an optional parameter diff --git a/github/GithubObjects/Label.py b/github/GithubObjects/Label.py index 7dbe6f3c..f279de37 100644 --- a/github/GithubObjects/Label.py +++ b/github/GithubObjects/Label.py @@ -1,6 +1,7 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import PaginatedList # This allows None as a valid value for an optional parameter class DefaultValueForOptionalParametersType: diff --git a/github/GithubObjects/Milestone.py b/github/GithubObjects/Milestone.py index d55cbd0f..2f52ba71 100644 --- a/github/GithubObjects/Milestone.py +++ b/github/GithubObjects/Milestone.py @@ -1,6 +1,7 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import PaginatedList import NamedUser import Label # This allows None as a valid value for an optional parameter @@ -101,10 +102,12 @@ class Milestone( object ): None, None ) - return [ - Label.Label( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + Label.Label, + self.__requester, + headers, + data + ) def __initAttributes( self ): self.__closed_issues = None diff --git a/github/GithubObjects/NamedUser.py b/github/GithubObjects/NamedUser.py index 15e2b9fe..a6b6990e 100644 --- a/github/GithubObjects/NamedUser.py +++ b/github/GithubObjects/NamedUser.py @@ -1,6 +1,7 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import PaginatedList import Organization import Gist import Event @@ -173,10 +174,12 @@ class NamedUser( object ): None, None ) - return [ - Event.Event( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + Event.Event, + self.__requester, + headers, + data + ) def get_followers( self ): status, headers, data = self.__requester.request( @@ -185,10 +188,12 @@ class NamedUser( object ): None, None ) - return [ - NamedUser( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + NamedUser, + self.__requester, + headers, + data + ) def get_following( self ): status, headers, data = self.__requester.request( @@ -197,10 +202,12 @@ class NamedUser( object ): None, None ) - return [ - NamedUser( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + NamedUser, + self.__requester, + headers, + data + ) def get_gists( self ): status, headers, data = self.__requester.request( @@ -209,10 +216,12 @@ class NamedUser( object ): None, None ) - return [ - Gist.Gist( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + Gist.Gist, + self.__requester, + headers, + data + ) def get_orgs( self ): status, headers, data = self.__requester.request( @@ -221,10 +230,12 @@ class NamedUser( object ): None, None ) - return [ - Organization.Organization( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + Organization.Organization, + self.__requester, + headers, + data + ) def get_public_events( self ): pass @@ -251,10 +262,12 @@ class NamedUser( object ): None, None ) - return [ - Repository.Repository( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + Repository.Repository, + self.__requester, + headers, + data + ) def get_watched( self ): status, headers, data = self.__requester.request( @@ -263,10 +276,12 @@ class NamedUser( object ): None, None ) - return [ - Repository.Repository( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + Repository.Repository, + self.__requester, + headers, + data + ) # @todo Remove '_identity' from the normalized json description @property diff --git a/github/GithubObjects/Organization.py b/github/GithubObjects/Organization.py index 872dba14..01f92a2b 100644 --- a/github/GithubObjects/Organization.py +++ b/github/GithubObjects/Organization.py @@ -1,6 +1,7 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import PaginatedList import Team import Event import Repository @@ -232,10 +233,12 @@ class Organization( object ): None, None ) - return [ - Event.Event( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + Event.Event, + self.__requester, + headers, + data + ) def get_members( self ): status, headers, data = self.__requester.request( @@ -244,10 +247,12 @@ class Organization( object ): None, None ) - return [ - NamedUser.NamedUser( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + NamedUser.NamedUser, + self.__requester, + headers, + data + ) def get_public_members( self ): status, headers, data = self.__requester.request( @@ -256,10 +261,12 @@ class Organization( object ): None, None ) - return [ - NamedUser.NamedUser( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + NamedUser.NamedUser, + self.__requester, + headers, + data + ) def get_repo( self, name ): status, headers, data = self.__requester.request( @@ -277,10 +284,12 @@ class Organization( object ): None, None ) - return [ - Repository.Repository( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + Repository.Repository, + self.__requester, + headers, + data + ) def get_teams( self ): status, headers, data = self.__requester.request( @@ -289,10 +298,12 @@ class Organization( object ): None, None ) - return [ - Team.Team( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + Team.Team, + self.__requester, + headers, + data + ) def has_in_members( self, member ): status, headers, data = self.__requester.request( diff --git a/github/GithubObjects/PaginatedList.py b/github/GithubObjects/PaginatedList.py new file mode 100644 index 00000000..4c47e68d --- /dev/null +++ b/github/GithubObjects/PaginatedList.py @@ -0,0 +1,49 @@ +class PaginatedListIterator: + def __init__( self, list ): + pass + + def next( self ): + return "foo" + +class PaginatedList: + def __init__( self, contentClass, requester, headers, data ): + self.__requester = requester + self.__contentClass = contentClass + self.__fromData( headers, data ) + + def __iter__( self ): + goOn = True + while goOn: + goOn = False + for element in self.__list: + yield element + if self.__nextUrl is not None: + goOn = True + status, headers, data = self.__requester.request( "GET", self.__nextUrl, None, None ) + self.__fromData( headers, data ) + + def __getitem__( self, index ): + return self.__list[ index ] + + def __fromData( self, headers, data ): + links = self.__parseLinkHeader( headers ) + if len( data ) > 0 and "next" in links: + self.__nextUrl = links[ "next" ] + else: + self.__nextUrl = None + + self.__list = [ + self.__contentClass( self.__requester, element, lazy = True ) + for element in data + ] + + def __parseLinkHeader( self, headers ): + links = {} + if "link" in headers: + linkHeaders = headers[ "link" ].split( "," ) + for linkHeader in linkHeaders: + ( url, rel ) = linkHeader.split( "; " ) + url = url[ 1 : -1 ] + rel = rel[ 5 : -1 ] + links[ rel ] = url + return links diff --git a/github/GithubObjects/PullRequest.py b/github/GithubObjects/PullRequest.py index 681c6d36..a9fb9fc1 100644 --- a/github/GithubObjects/PullRequest.py +++ b/github/GithubObjects/PullRequest.py @@ -1,6 +1,7 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import PaginatedList import Commit import NamedUser import PullRequestComment @@ -183,10 +184,12 @@ class PullRequest( object ): None, None ) - return [ - PullRequestComment.PullRequestComment( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + PullRequestComment.PullRequestComment, + self.__requester, + headers, + data + ) def get_commits( self ): status, headers, data = self.__requester.request( @@ -195,10 +198,12 @@ class PullRequest( object ): None, None ) - return [ - Commit.Commit( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + Commit.Commit, + self.__requester, + headers, + data + ) def get_files( self ): status, headers, data = self.__requester.request( @@ -207,10 +212,12 @@ class PullRequest( object ): None, None ) - return [ - PullRequestFile.PullRequestFile( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + PullRequestFile.PullRequestFile, + self.__requester, + headers, + data + ) def is_merged( self ): status, headers, data = self.__requester.request( diff --git a/github/GithubObjects/PullRequestComment.py b/github/GithubObjects/PullRequestComment.py index f4603fd9..a186de7b 100644 --- a/github/GithubObjects/PullRequestComment.py +++ b/github/GithubObjects/PullRequestComment.py @@ -1,6 +1,7 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import PaginatedList import NamedUser # This allows None as a valid value for an optional parameter diff --git a/github/GithubObjects/PullRequestFile.py b/github/GithubObjects/PullRequestFile.py index d6ea9e20..6da4f590 100644 --- a/github/GithubObjects/PullRequestFile.py +++ b/github/GithubObjects/PullRequestFile.py @@ -1,6 +1,7 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import PaginatedList # This allows None as a valid value for an optional parameter class DefaultValueForOptionalParametersType: diff --git a/github/GithubObjects/Repository.py b/github/GithubObjects/Repository.py index 15bae6b0..6ca54ba1 100644 --- a/github/GithubObjects/Repository.py +++ b/github/GithubObjects/Repository.py @@ -1,6 +1,7 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import PaginatedList import GitCommit import Team import PullRequest @@ -402,10 +403,12 @@ class Repository( object ): None, None ) - return [ - Branch.Branch( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + Branch.Branch, + self.__requester, + headers, + data + ) def get_collaborators( self ): status, headers, data = self.__requester.request( @@ -414,10 +417,12 @@ class Repository( object ): None, None ) - return [ - NamedUser.NamedUser( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + NamedUser.NamedUser, + self.__requester, + headers, + data + ) def get_comment( self, id ): status, headers, data = self.__requester.request( @@ -435,10 +440,12 @@ class Repository( object ): None, None ) - return [ - CommitComment.CommitComment( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + CommitComment.CommitComment, + self.__requester, + headers, + data + ) def get_commit( self, sha ): status, headers, data = self.__requester.request( @@ -456,10 +463,12 @@ class Repository( object ): None, None ) - return [ - Commit.Commit( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + Commit.Commit, + self.__requester, + headers, + data + ) def get_contributors( self ): status, headers, data = self.__requester.request( @@ -468,10 +477,12 @@ class Repository( object ): None, None ) - return [ - NamedUser.NamedUser( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + NamedUser.NamedUser, + self.__requester, + headers, + data + ) def get_download( self, id ): status, headers, data = self.__requester.request( @@ -489,10 +500,12 @@ class Repository( object ): None, None ) - return [ - Download.Download( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + Download.Download, + self.__requester, + headers, + data + ) def get_events( self ): status, headers, data = self.__requester.request( @@ -501,10 +514,12 @@ class Repository( object ): None, None ) - return [ - Event.Event( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + Event.Event, + self.__requester, + headers, + data + ) def get_forks( self ): status, headers, data = self.__requester.request( @@ -513,10 +528,12 @@ class Repository( object ): None, None ) - return [ - Repository( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + Repository, + self.__requester, + headers, + data + ) def get_git_blob( self, sha ): status, headers, data = self.__requester.request( @@ -552,10 +569,12 @@ class Repository( object ): None, None ) - return [ - GitRef.GitRef( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + GitRef.GitRef, + self.__requester, + headers, + data + ) def get_git_tag( self, sha ): status, headers, data = self.__requester.request( @@ -591,10 +610,12 @@ class Repository( object ): None, None ) - return [ - Hook.Hook( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + Hook.Hook, + self.__requester, + headers, + data + ) def get_issue( self, number ): status, headers, data = self.__requester.request( @@ -612,10 +633,12 @@ class Repository( object ): None, None ) - return [ - Issue.Issue( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + Issue.Issue, + self.__requester, + headers, + data + ) def get_issues_event( self, id ): status, headers, data = self.__requester.request( @@ -633,10 +656,12 @@ class Repository( object ): None, None ) - return [ - IssueEvent.IssueEvent( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + IssueEvent.IssueEvent, + self.__requester, + headers, + data + ) def get_key( self, id ): status, headers, data = self.__requester.request( @@ -654,10 +679,12 @@ class Repository( object ): None, None ) - return [ - RepositoryKey.RepositoryKey( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + RepositoryKey.RepositoryKey, + self.__requester, + headers, + data + ) def get_label( self, name ): status, headers, data = self.__requester.request( @@ -675,10 +702,12 @@ class Repository( object ): None, None ) - return [ - Label.Label( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + Label.Label, + self.__requester, + headers, + data + ) def get_languages( self ): pass @@ -699,10 +728,12 @@ class Repository( object ): None, None ) - return [ - Milestone.Milestone( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + Milestone.Milestone, + self.__requester, + headers, + data + ) def get_network_events( self ): pass @@ -723,10 +754,12 @@ class Repository( object ): None, None ) - return [ - PullRequest.PullRequest( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + PullRequest.PullRequest, + self.__requester, + headers, + data + ) def get_tags( self ): status, headers, data = self.__requester.request( @@ -735,10 +768,12 @@ class Repository( object ): None, None ) - return [ - Tag.Tag( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + Tag.Tag, + self.__requester, + headers, + data + ) def get_teams( self ): status, headers, data = self.__requester.request( @@ -747,10 +782,12 @@ class Repository( object ): None, None ) - return [ - Team.Team( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + Team.Team, + self.__requester, + headers, + data + ) def get_watchers( self ): status, headers, data = self.__requester.request( @@ -759,10 +796,12 @@ class Repository( object ): None, None ) - return [ - NamedUser.NamedUser( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + NamedUser.NamedUser, + self.__requester, + headers, + data + ) def has_in_collaborators( self, collaborator ): status, headers, data = self.__requester.request( diff --git a/github/GithubObjects/RepositoryKey.py b/github/GithubObjects/RepositoryKey.py index 056a7036..4b896a45 100644 --- a/github/GithubObjects/RepositoryKey.py +++ b/github/GithubObjects/RepositoryKey.py @@ -1,6 +1,7 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import PaginatedList # This allows None as a valid value for an optional parameter class DefaultValueForOptionalParametersType: diff --git a/github/GithubObjects/Tag.py b/github/GithubObjects/Tag.py index 50a21d4d..d43ca085 100644 --- a/github/GithubObjects/Tag.py +++ b/github/GithubObjects/Tag.py @@ -1,6 +1,7 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import PaginatedList import Commit # This allows None as a valid value for an optional parameter diff --git a/github/GithubObjects/Team.py b/github/GithubObjects/Team.py index 591a28ca..79caa67d 100644 --- a/github/GithubObjects/Team.py +++ b/github/GithubObjects/Team.py @@ -1,6 +1,7 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import PaginatedList import Repository import NamedUser # This allows None as a valid value for an optional parameter @@ -93,10 +94,12 @@ class Team( object ): None, None ) - return [ - NamedUser.NamedUser( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + NamedUser.NamedUser, + self.__requester, + headers, + data + ) def get_repos( self ): status, headers, data = self.__requester.request( @@ -105,10 +108,12 @@ class Team( object ): None, None ) - return [ - Repository.Repository( self.__requester, element, lazy = True ) - for element in data - ] + return PaginatedList.PaginatedList( + Repository.Repository, + self.__requester, + headers, + data + ) def has_in_members( self, member ): status, headers, data = self.__requester.request( diff --git a/github/GithubObjects/UserKey.py b/github/GithubObjects/UserKey.py index 9377a249..2c8abc08 100644 --- a/github/GithubObjects/UserKey.py +++ b/github/GithubObjects/UserKey.py @@ -1,6 +1,7 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import PaginatedList # This allows None as a valid value for an optional parameter class DefaultValueForOptionalParametersType: