mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 19:01:15 +00:00
@@ -105,6 +105,11 @@ class PaginatedList(PaginatedListBase):
|
||||
for repo in user.get_repos():
|
||||
print(repo.name)
|
||||
|
||||
If you want to know the total number of items in the list::
|
||||
|
||||
print(user.get_repos().totalCount)
|
||||
print(len(user.get_repos()))
|
||||
|
||||
You can also index them or take slices::
|
||||
|
||||
second_repo = user.get_repos()[1]
|
||||
@@ -115,7 +120,7 @@ class PaginatedList(PaginatedListBase):
|
||||
for repo in user.get_repos().reversed:
|
||||
print(repo.name)
|
||||
|
||||
And if you really need it, you can explicitely access a specific page::
|
||||
And if you really need it, you can explicitly access a specific page::
|
||||
|
||||
some_repos = user.get_repos().get_page(0)
|
||||
some_other_repos = user.get_repos().get_page(3)
|
||||
@@ -167,6 +172,9 @@ class PaginatedList(PaginatedListBase):
|
||||
lastUrl = links.get("last")
|
||||
return lastUrl
|
||||
|
||||
def __len__(self):
|
||||
return self.totalCount
|
||||
|
||||
@property
|
||||
def reversed(self):
|
||||
r = PaginatedList(self.__contentClass, self.__requester, self.__firstUrl, self.__firstParams)
|
||||
|
||||
Reference in New Issue
Block a user