mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 19:01:15 +00:00
Merge branch 'topic/ExposePagination' into develop
This commit is contained in:
+84
-79
@@ -1,13 +1,6 @@
|
||||
You don't normaly create instances of any class but `Github`.
|
||||
You obtain instances through calls to `search_`, `get_` and `create_` methods.
|
||||
|
||||
Methods returning an "iterator of `SomeType`" return an iterator which yields instances of `SomeType`.
|
||||
This implements lazy [pagination requests](http://developer.github.com/v3/#pagination).
|
||||
You can use this iterator in a `for f in user.get_followers():` loop or with any [itertools](http://docs.python.org/library/itertools.html) functions,
|
||||
but you cannot know the number of objects returned before the end of the iteration.
|
||||
If that's really what you need, you cant use `len( list( user.get_followers() ) )`, which does all the requests needed to enumerate the user's followers.
|
||||
Note that there is often an attribute giving this value (in that case `user.followers`).
|
||||
|
||||
Class `Github`
|
||||
==============
|
||||
|
||||
@@ -31,12 +24,12 @@ Methods
|
||||
* `get_organization( login )`: `Organization`
|
||||
* `get_gist( id )`: `Gist`
|
||||
* `id`: string
|
||||
* `get_gists()`: iterator of `Gist`
|
||||
* `get_hooks()`: iterator of `HookDescription`
|
||||
* `legacy_search_repos( keyword, [language] )`: iterator of `Repository`
|
||||
* `get_gists()`: `PaginatedList` of `Gist`
|
||||
* `get_hooks()`: `PaginatedList` of `HookDescription`
|
||||
* `legacy_search_repos( keyword, [language] )`: `PaginatedList` of `Repository`
|
||||
* `keyword`: string
|
||||
* `language`: string
|
||||
* `legacy_search_users( keyword )`: iterator of `NamedUser`
|
||||
* `legacy_search_users( keyword )`: `PaginatedList` of `NamedUser`
|
||||
* `keyword`: string
|
||||
* `legacy_search_user_by_email( email )`: `NamedUser`
|
||||
* `email`: string
|
||||
@@ -44,6 +37,18 @@ Methods
|
||||
* `text`: string
|
||||
* `context`: `Repository`
|
||||
|
||||
Class `PaginatedList`
|
||||
=====================
|
||||
|
||||
This class implements lazy [pagination requests](http://developer.github.com/v3/#pagination) and hides pagination from you. It is the return type of `get_` methods that return a collection.
|
||||
|
||||
You can iterate on it in a `for f in user.get_followers():` loop or with any [itertools](http://docs.python.org/library/itertools.html) functions.
|
||||
|
||||
You cannot know the number of objects returned before the end of the iteration. If that's *really* what you need, you cant use `len( list( user.get_followers() ) )`,
|
||||
which does all the requests needed to enumerate the user's followers. Note that there is often an attribute giving this value (in that case `user.followers`).
|
||||
|
||||
You can also call `get_page( page )` where `page` is an integer starting at 0, to explicitely get a specific page if you don't want to hide pagination.
|
||||
|
||||
Class `GithubException`
|
||||
=======================
|
||||
|
||||
@@ -91,7 +96,7 @@ Authorizations
|
||||
* `note_url`: string
|
||||
* `get_authorization( id )`: `Authorization`
|
||||
* `id`: integer
|
||||
* `get_authorizations()`: iterator of `Authorization`
|
||||
* `get_authorizations()`: `PaginatedList` of `Authorization`
|
||||
|
||||
Emails
|
||||
------
|
||||
@@ -103,19 +108,19 @@ Emails
|
||||
|
||||
Events
|
||||
------
|
||||
* `get_events()`: iterator of `Event`
|
||||
* `get_organization_events( org )`: iterator of `Event`
|
||||
* `get_events()`: `PaginatedList` of `Event`
|
||||
* `get_organization_events( org )`: `PaginatedList` of `Event`
|
||||
* `org`: `Organization`
|
||||
|
||||
Followers
|
||||
---------
|
||||
* `get_followers()`: iterator of `NamedUser`
|
||||
* `get_followers()`: `PaginatedList` of `NamedUser`
|
||||
|
||||
Following
|
||||
---------
|
||||
* `add_to_following( following )`
|
||||
* `following`: `NamedUser`
|
||||
* `get_following()`: iterator of `NamedUser`
|
||||
* `get_following()`: `PaginatedList` of `NamedUser`
|
||||
* `has_in_following( following )`: bool
|
||||
* `following`: `NamedUser`
|
||||
* `remove_from_following( following )`
|
||||
@@ -132,12 +137,12 @@ Gists
|
||||
* `public`: bool
|
||||
* `files`: dict of string to `InputFileContent`
|
||||
* `description`: string
|
||||
* `get_gists()`: iterator of `Gist`
|
||||
* `get_starred_gists()`: iterator of `Gist`
|
||||
* `get_gists()`: `PaginatedList` of `Gist`
|
||||
* `get_starred_gists()`: `PaginatedList` of `Gist`
|
||||
|
||||
Issues
|
||||
------
|
||||
* `get_issues()`: iterator of `Issue`
|
||||
* `get_issues()`: `PaginatedList` of `Issue`
|
||||
|
||||
Keys
|
||||
----
|
||||
@@ -146,7 +151,7 @@ Keys
|
||||
* `key`: string
|
||||
* `get_key( id )`: `UserKey`
|
||||
* `id`: integer
|
||||
* `get_keys()`: iterator of `UserKey`
|
||||
* `get_keys()`: `PaginatedList` of `UserKey`
|
||||
|
||||
Modification
|
||||
------------
|
||||
@@ -161,7 +166,7 @@ Modification
|
||||
|
||||
Orgs
|
||||
----
|
||||
* `get_orgs()`: iterator of `Organization`
|
||||
* `get_orgs()`: `PaginatedList` of `Organization`
|
||||
|
||||
Repos
|
||||
-----
|
||||
@@ -175,7 +180,7 @@ Repos
|
||||
* `has_downloads`: bool
|
||||
* `get_repo( name )`: `Repository`
|
||||
* `name`: string
|
||||
* `get_repos( [type, sort, direction] )`: iterator of `Repository`
|
||||
* `get_repos( [type, sort, direction] )`: `PaginatedList` of `Repository`
|
||||
* `type`: string
|
||||
* `sort`: string
|
||||
* `direction`: string
|
||||
@@ -184,7 +189,7 @@ Starred
|
||||
-------
|
||||
* `add_to_starred( starred )`
|
||||
* `starred`: `Repository`
|
||||
* `get_starred()`: iterator of `Repository`
|
||||
* `get_starred()`: `PaginatedList` of `Repository`
|
||||
* `has_in_starred( starred )`: bool
|
||||
* `starred`: `Repository`
|
||||
* `remove_from_starred( starred )`
|
||||
@@ -194,7 +199,7 @@ Subscriptions
|
||||
-------------
|
||||
* `add_to_subscriptions( subscription )`
|
||||
* `subscription`: `Repository`
|
||||
* `get_subscriptions()`: iterator of `Repository`
|
||||
* `get_subscriptions()`: `PaginatedList` of `Repository`
|
||||
* `has_in_subscriptions( subscription )`: bool
|
||||
* `subscription`: `Repository`
|
||||
* `remove_from_subscriptions( subscription )`
|
||||
@@ -204,7 +209,7 @@ Watched
|
||||
-------
|
||||
* `add_to_watched( watched )`
|
||||
* `watched`: `Repository`
|
||||
* `get_watched()`: iterator of `Repository`
|
||||
* `get_watched()`: `PaginatedList` of `Repository`
|
||||
* `has_in_watched( watched )`: bool
|
||||
* `watched`: `Repository`
|
||||
* `remove_from_watched( watched )`
|
||||
@@ -275,7 +280,7 @@ Comments
|
||||
* `line`: integer
|
||||
* `path`: string
|
||||
* `position`: integer
|
||||
* `get_comments()`: iterator of `CommitComment`
|
||||
* `get_comments()`: `PaginatedList` of `CommitComment`
|
||||
|
||||
Statuses
|
||||
--------
|
||||
@@ -283,7 +288,7 @@ Statuses
|
||||
* `state`: string
|
||||
* `target_url`: string
|
||||
* `description`: string
|
||||
* `get_statuses()`: iterator of `CommitStatus`
|
||||
* `get_statuses()`: `PaginatedList` of `CommitStatus`
|
||||
|
||||
Class `CommitComment`
|
||||
=====================
|
||||
@@ -450,7 +455,7 @@ Comments
|
||||
* `body`: string
|
||||
* `get_comment( id )`: `GistComment`
|
||||
* `id`: integer
|
||||
* `get_comments()`: iterator of `GistComment`
|
||||
* `get_comments()`: `PaginatedList` of `GistComment`
|
||||
|
||||
Deletion
|
||||
--------
|
||||
@@ -691,18 +696,18 @@ Comments
|
||||
* `body`: string
|
||||
* `get_comment( id )`: `IssueComment`
|
||||
* `id`: integer
|
||||
* `get_comments()`: iterator of `IssueComment`
|
||||
* `get_comments()`: `PaginatedList` of `IssueComment`
|
||||
|
||||
Events
|
||||
------
|
||||
* `get_events()`: iterator of `IssueEvent`
|
||||
* `get_events()`: `PaginatedList` of `IssueEvent`
|
||||
|
||||
Labels
|
||||
------
|
||||
* `add_to_labels( label, ... )`
|
||||
* `label`: `Label`
|
||||
* `delete_labels()`
|
||||
* `get_labels()`: iterator of `Label`
|
||||
* `get_labels()`: `PaginatedList` of `Label`
|
||||
* `remove_from_labels( label )`
|
||||
* `label`: `Label`
|
||||
* `set_labels( label, ... )`
|
||||
@@ -803,7 +808,7 @@ Deletion
|
||||
|
||||
Labels
|
||||
------
|
||||
* `get_labels()`: iterator of `Label`
|
||||
* `get_labels()`: `PaginatedList` of `Label`
|
||||
|
||||
Modification
|
||||
------------
|
||||
@@ -847,18 +852,18 @@ Attributes
|
||||
|
||||
Events
|
||||
------
|
||||
* `get_events()`: iterator of `Event`
|
||||
* `get_public_events()`: iterator of `Event`
|
||||
* `get_received_events()`: iterator of `Event`
|
||||
* `get_public_received_events()`: iterator of `Event`
|
||||
* `get_events()`: `PaginatedList` of `Event`
|
||||
* `get_public_events()`: `PaginatedList` of `Event`
|
||||
* `get_received_events()`: `PaginatedList` of `Event`
|
||||
* `get_public_received_events()`: `PaginatedList` of `Event`
|
||||
|
||||
Followers
|
||||
---------
|
||||
* `get_followers()`: iterator of `NamedUser`
|
||||
* `get_followers()`: `PaginatedList` of `NamedUser`
|
||||
|
||||
Following
|
||||
---------
|
||||
* `get_following()`: iterator of `NamedUser`
|
||||
* `get_following()`: `PaginatedList` of `NamedUser`
|
||||
|
||||
Gists
|
||||
-----
|
||||
@@ -866,30 +871,30 @@ Gists
|
||||
* `public`: bool
|
||||
* `files`: dict of string to `InputFileContent`
|
||||
* `description`: string
|
||||
* `get_gists()`: iterator of `Gist`
|
||||
* `get_gists()`: `PaginatedList` of `Gist`
|
||||
|
||||
Orgs
|
||||
----
|
||||
* `get_orgs()`: iterator of `Organization`
|
||||
* `get_orgs()`: `PaginatedList` of `Organization`
|
||||
|
||||
Repos
|
||||
-----
|
||||
* `get_repo( name )`: `Repository`
|
||||
* `name`: string
|
||||
* `get_repos( [type] )`: iterator of `Repository`
|
||||
* `get_repos( [type] )`: `PaginatedList` of `Repository`
|
||||
* `type`: string
|
||||
|
||||
Starred
|
||||
-------
|
||||
* `get_starred()`: iterator of `Repository`
|
||||
* `get_starred()`: `PaginatedList` of `Repository`
|
||||
|
||||
Subscriptions
|
||||
-------------
|
||||
* `get_subscriptions()`: iterator of `Repository`
|
||||
* `get_subscriptions()`: `PaginatedList` of `Repository`
|
||||
|
||||
Watched
|
||||
-------
|
||||
* `get_watched()`: iterator of `Repository`
|
||||
* `get_watched()`: `PaginatedList` of `Repository`
|
||||
|
||||
Class `Organization`
|
||||
====================
|
||||
@@ -923,7 +928,7 @@ Attributes
|
||||
|
||||
Events
|
||||
------
|
||||
* `get_events()`: iterator of `Event`
|
||||
* `get_events()`: `PaginatedList` of `Event`
|
||||
|
||||
Forking
|
||||
-------
|
||||
@@ -932,7 +937,7 @@ Forking
|
||||
|
||||
Members
|
||||
-------
|
||||
* `get_members()`: iterator of `NamedUser`
|
||||
* `get_members()`: `PaginatedList` of `NamedUser`
|
||||
* `has_in_members( member )`: bool
|
||||
* `member`: `NamedUser`
|
||||
* `remove_from_members( member )`
|
||||
@@ -952,7 +957,7 @@ Public_members
|
||||
--------------
|
||||
* `add_to_public_members( public_member )`
|
||||
* `public_member`: `NamedUser`
|
||||
* `get_public_members()`: iterator of `NamedUser`
|
||||
* `get_public_members()`: `PaginatedList` of `NamedUser`
|
||||
* `has_in_public_members( public_member )`: bool
|
||||
* `public_member`: `NamedUser`
|
||||
* `remove_from_public_members( public_member )`
|
||||
@@ -971,7 +976,7 @@ Repos
|
||||
* `team_id`: `Team`
|
||||
* `get_repo( name )`: `Repository`
|
||||
* `name`: string
|
||||
* `get_repos( [type] )`: iterator of `Repository`
|
||||
* `get_repos( [type] )`: `PaginatedList` of `Repository`
|
||||
* `type`: string
|
||||
|
||||
Teams
|
||||
@@ -982,7 +987,7 @@ Teams
|
||||
* `permission`: string
|
||||
* `get_team( id )`: `Team`
|
||||
* `id`: integer
|
||||
* `get_teams()`: iterator of `Team`
|
||||
* `get_teams()`: `PaginatedList` of `Team`
|
||||
|
||||
Class `Permissions`
|
||||
===================
|
||||
@@ -1044,15 +1049,15 @@ Review comments
|
||||
* `position`: integer
|
||||
* `get_comment( id )` or `get_review_comment( id )`: `PullRequestComment`
|
||||
* `id`: integer
|
||||
* `get_comments()` or `get_review_comments()`: iterator of `PullRequestComment`
|
||||
* `get_comments()` or `get_review_comments()`: `PaginatedList` of `PullRequestComment`
|
||||
|
||||
Commits
|
||||
-------
|
||||
* `get_commits()`: iterator of `Commit`
|
||||
* `get_commits()`: `PaginatedList` of `Commit`
|
||||
|
||||
Files
|
||||
-----
|
||||
* `get_files()`: iterator of `File`
|
||||
* `get_files()`: `PaginatedList` of `File`
|
||||
|
||||
Issue_comments
|
||||
--------------
|
||||
@@ -1060,7 +1065,7 @@ Issue_comments
|
||||
* `body`: string
|
||||
* `get_issue_comment( id )`: `IssueComment`
|
||||
* `id`: integer
|
||||
* `get_issue_comments()`: iterator of `IssueComment`
|
||||
* `get_issue_comments()`: `PaginatedList` of `IssueComment`
|
||||
|
||||
Merging
|
||||
-------
|
||||
@@ -1165,7 +1170,7 @@ Comparison
|
||||
|
||||
Assignees
|
||||
---------
|
||||
* `get_assignees()`: iterator of `NamedUser`
|
||||
* `get_assignees()`: `PaginatedList` of `NamedUser`
|
||||
* `has_in_assignees( assignee )`: bool
|
||||
* `assignee`: `NamedUser`
|
||||
|
||||
@@ -1173,13 +1178,13 @@ Branches
|
||||
--------
|
||||
* `get_branch( branch )`: `Branch`
|
||||
* `branch`: string
|
||||
* `get_branches()`: iterator of `Branch`
|
||||
* `get_branches()`: `PaginatedList` of `Branch`
|
||||
|
||||
Collaborators
|
||||
-------------
|
||||
* `add_to_collaborators( collaborator )`
|
||||
* `collaborator`: `NamedUser`
|
||||
* `get_collaborators()`: iterator of `NamedUser`
|
||||
* `get_collaborators()`: `PaginatedList` of `NamedUser`
|
||||
* `has_in_collaborators( collaborator )`: bool
|
||||
* `collaborator`: `NamedUser`
|
||||
* `remove_from_collaborators( collaborator )`
|
||||
@@ -1189,13 +1194,13 @@ Comments
|
||||
--------
|
||||
* `get_comment( id )`: `CommitComment`
|
||||
* `id`: integer
|
||||
* `get_comments()`: iterator of `CommitComment`
|
||||
* `get_comments()`: `PaginatedList` of `CommitComment`
|
||||
|
||||
Commits
|
||||
-------
|
||||
* `get_commit( sha )`: `Commit`
|
||||
* `sha`: string
|
||||
* `get_commits( [sha, path] )`: iterator of `Commit`
|
||||
* `get_commits( [sha, path] )`: `PaginatedList` of `Commit`
|
||||
* `sha`: string
|
||||
* `path`: string
|
||||
|
||||
@@ -1210,7 +1215,7 @@ Contents
|
||||
|
||||
Contributors
|
||||
------------
|
||||
* `get_contributors()`: iterator of `NamedUser`
|
||||
* `get_contributors()`: `PaginatedList` of `NamedUser`
|
||||
|
||||
Deletion
|
||||
--------
|
||||
@@ -1225,16 +1230,16 @@ Downloads
|
||||
* `content_type`: string
|
||||
* `get_download( id )`: `Download`
|
||||
* `id`: integer
|
||||
* `get_downloads()`: iterator of `Download`
|
||||
* `get_downloads()`: `PaginatedList` of `Download`
|
||||
|
||||
Events
|
||||
------
|
||||
* `get_events()`: iterator of `Event`
|
||||
* `get_network_events()`: iterator of `Event`
|
||||
* `get_events()`: `PaginatedList` of `Event`
|
||||
* `get_network_events()`: `PaginatedList` of `Event`
|
||||
|
||||
Forks
|
||||
-----
|
||||
* `get_forks()`: iterator of `Repository`
|
||||
* `get_forks()`: `PaginatedList` of `Repository`
|
||||
|
||||
Git_blobs
|
||||
---------
|
||||
@@ -1262,7 +1267,7 @@ Git_refs
|
||||
* `sha`: string
|
||||
* `get_git_ref( ref )`: `GitRef`
|
||||
* `ref`: string
|
||||
* `get_git_refs()`: iterator of `GitRef`
|
||||
* `get_git_refs()`: `PaginatedList` of `GitRef`
|
||||
|
||||
Git_tags
|
||||
--------
|
||||
@@ -1293,7 +1298,7 @@ Hooks
|
||||
* `active`: bool
|
||||
* `get_hook( id )`: `Hook`
|
||||
* `id`: integer
|
||||
* `get_hooks()`: iterator of `Hook`
|
||||
* `get_hooks()`: `PaginatedList` of `Hook`
|
||||
|
||||
Issues
|
||||
------
|
||||
@@ -1305,7 +1310,7 @@ Issues
|
||||
* `labels`: list of `Label`
|
||||
* `get_issue( number )`: `Issue`
|
||||
* `number`: integer
|
||||
* `get_issues( [milestone, state, assignee, mentioned, labels, sort, direction, since] )`: iterator of `Issue`
|
||||
* `get_issues( [milestone, state, assignee, mentioned, labels, sort, direction, since] )`: `PaginatedList` of `Issue`
|
||||
* `milestone`: `Milestone` or "none" or "*"
|
||||
* `state`: string
|
||||
* `assignee`: `NamedUser` or "none" or "*"
|
||||
@@ -1314,7 +1319,7 @@ Issues
|
||||
* `sort`: string
|
||||
* `direction`: string
|
||||
* `since`: datetime.datetime
|
||||
* `legacy_search_issues( state, keyword )`: iterator of `Issue`
|
||||
* `legacy_search_issues( state, keyword )`: `PaginatedList` of `Issue`
|
||||
* `state`: "open" or "closed"
|
||||
* `keyword`: string
|
||||
|
||||
@@ -1322,7 +1327,7 @@ Issues_events
|
||||
-------------
|
||||
* `get_issues_event( id )`: `IssueEvent`
|
||||
* `id`: integer
|
||||
* `get_issues_events()`: iterator of `IssueEvent`
|
||||
* `get_issues_events()`: `PaginatedList` of `IssueEvent`
|
||||
|
||||
Keys
|
||||
----
|
||||
@@ -1331,7 +1336,7 @@ Keys
|
||||
* `key`: string
|
||||
* `get_key( id )`: `RepositoryKey`
|
||||
* `id`: integer
|
||||
* `get_keys()`: iterator of `RepositoryKey`
|
||||
* `get_keys()`: `PaginatedList` of `RepositoryKey`
|
||||
|
||||
Labels
|
||||
------
|
||||
@@ -1340,7 +1345,7 @@ Labels
|
||||
* `color`: string
|
||||
* `get_label( name )`: `Label`
|
||||
* `name`: string
|
||||
* `get_labels()`: iterator of `Label`
|
||||
* `get_labels()`: `PaginatedList` of `Label`
|
||||
|
||||
Languages
|
||||
---------
|
||||
@@ -1362,7 +1367,7 @@ Milestones
|
||||
* `due_on`: date
|
||||
* `get_milestone( number )`: `Milestone`
|
||||
* `number`: integer
|
||||
* `get_milestones( [state, sort, direction] )`: iterator of `Milestone`
|
||||
* `get_milestones( [state, sort, direction] )`: `PaginatedList` of `Milestone`
|
||||
* `state`: string
|
||||
* `sort`: string
|
||||
* `direction`: string
|
||||
@@ -1388,28 +1393,28 @@ Pulls
|
||||
* `head`: string
|
||||
* `get_pull( number )`: `PullRequest`
|
||||
* `number`: integer
|
||||
* `get_pulls( [state] )`: iterator of `PullRequest`
|
||||
* `get_pulls( [state] )`: `PaginatedList` of `PullRequest`
|
||||
* `state`: string
|
||||
|
||||
Stargazers
|
||||
----------
|
||||
* `get_stargazers()`: iterator of `NamedUser`
|
||||
* `get_stargazers()`: `PaginatedList` of `NamedUser`
|
||||
|
||||
Subscribers
|
||||
-----------
|
||||
* `get_subscribers()`: iterator of `NamedUser`
|
||||
* `get_subscribers()`: `PaginatedList` of `NamedUser`
|
||||
|
||||
Tags
|
||||
----
|
||||
* `get_tags()`: iterator of `Tag`
|
||||
* `get_tags()`: `PaginatedList` of `Tag`
|
||||
|
||||
Teams
|
||||
-----
|
||||
* `get_teams()`: iterator of `Team`
|
||||
* `get_teams()`: `PaginatedList` of `Team`
|
||||
|
||||
Watchers
|
||||
--------
|
||||
* `get_watchers()`: iterator of `NamedUser`
|
||||
* `get_watchers()`: `PaginatedList` of `NamedUser`
|
||||
|
||||
Class `RepositoryKey`
|
||||
=====================
|
||||
@@ -1462,7 +1467,7 @@ Members
|
||||
-------
|
||||
* `add_to_members( member )`
|
||||
* `member`: `NamedUser`
|
||||
* `get_members()`: iterator of `NamedUser`
|
||||
* `get_members()`: `PaginatedList` of `NamedUser`
|
||||
* `has_in_members( member )`: bool
|
||||
* `member`: `NamedUser`
|
||||
* `remove_from_members( member )`
|
||||
@@ -1478,7 +1483,7 @@ Repos
|
||||
-----
|
||||
* `add_to_repos( repo )`
|
||||
* `repo`: `Repository`
|
||||
* `get_repos()`: iterator of `Repository`
|
||||
* `get_repos()`: `PaginatedList` of `Repository`
|
||||
* `has_in_repos( repo )`: bool
|
||||
* `repo`: `Repository`
|
||||
* `remove_from_repos( repo )`
|
||||
|
||||
+28
-112
@@ -332,17 +332,11 @@ class AuthenticatedUser( GithubObject.GithubObject ):
|
||||
return Authorization.Authorization( self._requester, data, completed = True )
|
||||
|
||||
def get_authorizations( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
"/authorizations",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
Authorization.Authorization,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
"/authorizations",
|
||||
None
|
||||
)
|
||||
|
||||
def get_emails( self ):
|
||||
@@ -355,73 +349,43 @@ class AuthenticatedUser( GithubObject.GithubObject ):
|
||||
return data
|
||||
|
||||
def get_events( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
"/events",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
Event.Event,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
"/events",
|
||||
None
|
||||
)
|
||||
|
||||
def get_followers( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
"/user/followers",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
NamedUser.NamedUser,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
"/user/followers",
|
||||
None
|
||||
)
|
||||
|
||||
def get_following( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
"/user/following",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
NamedUser.NamedUser,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
"/user/following",
|
||||
None
|
||||
)
|
||||
|
||||
def get_gists( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
"/gists",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
Gist.Gist,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
"/gists",
|
||||
None
|
||||
)
|
||||
|
||||
def get_issues( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
"/issues",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
Issue.Issue,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
"/issues",
|
||||
None
|
||||
)
|
||||
|
||||
def get_key( self, id ):
|
||||
@@ -435,46 +399,28 @@ class AuthenticatedUser( GithubObject.GithubObject ):
|
||||
return UserKey.UserKey( self._requester, data, completed = True )
|
||||
|
||||
def get_keys( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
"/user/keys",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
UserKey.UserKey,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
"/user/keys",
|
||||
None
|
||||
)
|
||||
|
||||
def get_organization_events( self, org ):
|
||||
assert isinstance( org, Organization.Organization ), org
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
"/users/" + self.login + "/events/orgs/" + org.login,
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
Event.Event,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
"/users/" + self.login + "/events/orgs/" + org.login,
|
||||
None
|
||||
)
|
||||
|
||||
def get_orgs( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
"/user/orgs",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
Organization.Organization,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
"/user/orgs",
|
||||
None
|
||||
)
|
||||
|
||||
def get_repo( self, name ):
|
||||
@@ -498,73 +444,43 @@ class AuthenticatedUser( GithubObject.GithubObject ):
|
||||
url_parameters[ "sort" ] = sort
|
||||
if direction is not GithubObject.NotSet:
|
||||
url_parameters[ "direction" ] = direction
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
"/user/repos",
|
||||
url_parameters,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
Repository.Repository,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
"/user/repos",
|
||||
url_parameters
|
||||
)
|
||||
|
||||
def get_starred( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
"/user/starred",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
Repository.Repository,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
"/user/starred",
|
||||
None
|
||||
)
|
||||
|
||||
def get_starred_gists( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
"/gists/starred",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
Gist.Gist,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
"/gists/starred",
|
||||
None
|
||||
)
|
||||
|
||||
def get_subscriptions( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
"/user/subscriptions",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
Repository.Repository,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
"/user/subscriptions",
|
||||
None
|
||||
)
|
||||
|
||||
def get_watched( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
"/user/watched",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
Repository.Repository,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
"/user/watched",
|
||||
None
|
||||
)
|
||||
|
||||
def has_in_following( self, following ):
|
||||
|
||||
+4
-16
@@ -105,31 +105,19 @@ class Commit( GithubObject.GithubObject ):
|
||||
return CommitStatus.CommitStatus( self._requester, data, completed = True )
|
||||
|
||||
def get_comments( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/comments",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
CommitComment.CommitComment,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/comments",
|
||||
None
|
||||
)
|
||||
|
||||
def get_statuses( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self._parentUrl( self._parentUrl( self.url ) ) + "/statuses/" + self.sha,
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
CommitStatus.CommitStatus,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self._parentUrl( self._parentUrl( self.url ) ) + "/statuses/" + self.sha,
|
||||
None
|
||||
)
|
||||
|
||||
@property
|
||||
|
||||
+2
-8
@@ -154,17 +154,11 @@ class Gist( GithubObject.GithubObject ):
|
||||
return GistComment.GistComment( self._requester, data, completed = True )
|
||||
|
||||
def get_comments( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/comments",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
GistComment.GistComment,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/comments",
|
||||
None
|
||||
)
|
||||
|
||||
def is_starred( self ):
|
||||
|
||||
+2
-3
@@ -69,12 +69,11 @@ class Github( object ):
|
||||
return Gist.Gist( self.__requester, data, completed = True )
|
||||
|
||||
def get_gists( self ):
|
||||
headers, data = self.__requester.requestAndCheck( "GET", "/gists/public", None, None )
|
||||
return PaginatedList.PaginatedList(
|
||||
Gist.Gist,
|
||||
self.__requester,
|
||||
headers,
|
||||
data
|
||||
"/gists/public",
|
||||
None
|
||||
)
|
||||
|
||||
def legacy_search_repos( self, keyword, language = GithubObject.NotSet ):
|
||||
|
||||
+6
-24
@@ -183,45 +183,27 @@ class Issue( GithubObject.GithubObject ):
|
||||
return IssueComment.IssueComment( self._requester, data, completed = True )
|
||||
|
||||
def get_comments( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/comments",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
IssueComment.IssueComment,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/comments",
|
||||
None
|
||||
)
|
||||
|
||||
def get_events( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/events",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
IssueEvent.IssueEvent,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/events",
|
||||
None
|
||||
)
|
||||
|
||||
def get_labels( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/labels",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
Label.Label,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/labels",
|
||||
None
|
||||
)
|
||||
|
||||
def remove_from_labels( self, label ):
|
||||
|
||||
+11
-6
@@ -15,28 +15,33 @@ from PaginatedList import PaginatedListBase
|
||||
|
||||
class PaginatedList( PaginatedListBase ):
|
||||
def __init__( self, url, args, requester, key, convert, contentClass ):
|
||||
PaginatedListBase.__init__( self, list() )
|
||||
PaginatedListBase.__init__( self )
|
||||
self.__url = url
|
||||
self.__args = args
|
||||
self.__requester = requester
|
||||
self.__key = key
|
||||
self.__convert = convert
|
||||
self.__contentClass = contentClass
|
||||
self.__nextPage = 1
|
||||
self.__nextPage = 0
|
||||
self.__continue = True
|
||||
self.__elements = list()
|
||||
|
||||
def _couldGrow( self ):
|
||||
return self.__continue
|
||||
|
||||
def _fetchNextPage( self ):
|
||||
if self.__nextPage != 1:
|
||||
self.__args[ "start_page" ] = self.__nextPage
|
||||
page = self.__nextPage
|
||||
self.__nextPage += 1
|
||||
return self.get_page( page )
|
||||
|
||||
def get_page( self, page ):
|
||||
assert isinstance( page, int ), page
|
||||
args = dict( self.__args )
|
||||
if page != 0:
|
||||
args[ "start_page" ] = page + 1
|
||||
headers, data = self.__requester.requestAndCheck(
|
||||
"GET",
|
||||
self.__url,
|
||||
self.__args,
|
||||
args,
|
||||
None
|
||||
)
|
||||
self.__continue = len( data[ self.__key ] ) > 0
|
||||
|
||||
+2
-8
@@ -106,17 +106,11 @@ class Milestone( GithubObject.GithubObject ):
|
||||
self._useAttributes( data )
|
||||
|
||||
def get_labels( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/labels",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
Label.Label,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/labels",
|
||||
None
|
||||
)
|
||||
|
||||
@property
|
||||
|
||||
+24
-96
@@ -172,115 +172,67 @@ class NamedUser( GithubObject.GithubObject ):
|
||||
return Gist.Gist( self._requester, data, completed = True )
|
||||
|
||||
def get_events( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/events",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
Event.Event,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/events",
|
||||
None
|
||||
)
|
||||
|
||||
def get_followers( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/followers",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
NamedUser,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/followers",
|
||||
None
|
||||
)
|
||||
|
||||
def get_following( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/following",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
NamedUser,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/following",
|
||||
None
|
||||
)
|
||||
|
||||
def get_gists( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/gists",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
Gist.Gist,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/gists",
|
||||
None
|
||||
)
|
||||
|
||||
def get_orgs( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/orgs",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
Organization.Organization,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/orgs",
|
||||
None
|
||||
)
|
||||
|
||||
def get_public_events( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/events/public",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
Event.Event,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/events/public",
|
||||
None
|
||||
)
|
||||
|
||||
def get_public_received_events( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/received_events/public",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
Event.Event,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/received_events/public",
|
||||
None
|
||||
)
|
||||
|
||||
def get_received_events( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/received_events",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
Event.Event,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/received_events",
|
||||
None
|
||||
)
|
||||
|
||||
def get_repo( self, name ):
|
||||
@@ -298,59 +250,35 @@ class NamedUser( GithubObject.GithubObject ):
|
||||
url_parameters = dict()
|
||||
if type is not GithubObject.NotSet:
|
||||
url_parameters[ "type" ] = type
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/repos",
|
||||
url_parameters,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
Repository.Repository,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/repos",
|
||||
url_parameters
|
||||
)
|
||||
|
||||
def get_starred( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/starred",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
Repository.Repository,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/starred",
|
||||
None
|
||||
)
|
||||
|
||||
def get_subscriptions( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/subscriptions",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
Repository.Repository,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/subscriptions",
|
||||
None
|
||||
)
|
||||
|
||||
def get_watched( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/watched",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
Repository.Repository,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/watched",
|
||||
None
|
||||
)
|
||||
|
||||
@property
|
||||
|
||||
+10
-40
@@ -245,45 +245,27 @@ class Organization( GithubObject.GithubObject ):
|
||||
self._useAttributes( data )
|
||||
|
||||
def get_events( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/events",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
Event.Event,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/events",
|
||||
None
|
||||
)
|
||||
|
||||
def get_members( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/members",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
NamedUser.NamedUser,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/members",
|
||||
None
|
||||
)
|
||||
|
||||
def get_public_members( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/public_members",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
NamedUser.NamedUser,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/public_members",
|
||||
None
|
||||
)
|
||||
|
||||
def get_repo( self, name ):
|
||||
@@ -301,17 +283,11 @@ class Organization( GithubObject.GithubObject ):
|
||||
url_parameters = dict()
|
||||
if type is not GithubObject.NotSet:
|
||||
url_parameters[ "type" ] = type
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/repos",
|
||||
url_parameters,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
Repository.Repository,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/repos",
|
||||
url_parameters
|
||||
)
|
||||
|
||||
def get_team( self, id ):
|
||||
@@ -325,17 +301,11 @@ class Organization( GithubObject.GithubObject ):
|
||||
return Team.Team( self._requester, data, completed = True )
|
||||
|
||||
def get_teams( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/teams",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
Team.Team,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/teams",
|
||||
None
|
||||
)
|
||||
|
||||
def has_in_members( self, member ):
|
||||
|
||||
+21
-7
@@ -14,8 +14,8 @@
|
||||
import GithubObject
|
||||
|
||||
class PaginatedListBase:
|
||||
def __init__( self, firstElements ):
|
||||
self.__elements = firstElements
|
||||
def __init__( self ):
|
||||
self.__elements = list()
|
||||
|
||||
def __getitem__( self, index ):
|
||||
assert isinstance( index, ( int, slice ) )
|
||||
@@ -65,24 +65,27 @@ class PaginatedListBase:
|
||||
return self.__stop is not None and index >= self.__stop
|
||||
|
||||
class PaginatedList( PaginatedListBase ):
|
||||
def __init__( self, contentClass, requester, headers, data ):
|
||||
def __init__( self, contentClass, requester, firstUrl, firstParams ):
|
||||
PaginatedListBase.__init__( self )
|
||||
self.__requester = requester
|
||||
self.__contentClass = contentClass
|
||||
PaginatedListBase.__init__( self, self.__extractNewElements( headers, data ) )
|
||||
self.__firstUrl = firstUrl
|
||||
self.__firstParams = firstParams
|
||||
self.__nextUrl = firstUrl
|
||||
self.__nextParams = firstParams
|
||||
|
||||
def _couldGrow( self ):
|
||||
return self.__nextUrl is not None
|
||||
|
||||
def _fetchNextPage( self ):
|
||||
headers, data = self.__requester.requestAndCheck( "GET", self.__nextUrl, None, None )
|
||||
return self.__extractNewElements( headers, data )
|
||||
headers, data = self.__requester.requestAndCheck( "GET", self.__nextUrl, self.__nextParams, None )
|
||||
|
||||
def __extractNewElements( self, headers, data ):
|
||||
links = self.__parseLinkHeader( headers )
|
||||
if len( data ) > 0 and "next" in links:
|
||||
self.__nextUrl = links[ "next" ]
|
||||
else:
|
||||
self.__nextUrl = None
|
||||
self.__nextParams = None
|
||||
|
||||
return [
|
||||
self.__contentClass( self.__requester, element, completed = False )
|
||||
@@ -99,3 +102,14 @@ class PaginatedList( PaginatedListBase ):
|
||||
rel = rel[ 5 : -1 ]
|
||||
links[ rel ] = url
|
||||
return links
|
||||
|
||||
def get_page( self, page ):
|
||||
params = dict( self.__firstParams )
|
||||
if page != 0:
|
||||
params[ "page" ] = page + 1
|
||||
headers, data = self.__requester.requestAndCheck( "GET", self.__firstUrl, params, None )
|
||||
|
||||
return [
|
||||
self.__contentClass( self.__requester, element, completed = False )
|
||||
for element in data
|
||||
]
|
||||
|
||||
+8
-32
@@ -224,45 +224,27 @@ class PullRequest( GithubObject.GithubObject ):
|
||||
return self.get_review_comments()
|
||||
|
||||
def get_review_comments( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/comments",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
PullRequestComment.PullRequestComment,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/comments",
|
||||
None
|
||||
)
|
||||
|
||||
def get_commits( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/commits",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
Commit.Commit,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/commits",
|
||||
None
|
||||
)
|
||||
|
||||
def get_files( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/files",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
File.File,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/files",
|
||||
None
|
||||
)
|
||||
|
||||
def get_issue_comment( self, id ):
|
||||
@@ -276,17 +258,11 @@ class PullRequest( GithubObject.GithubObject ):
|
||||
return IssueComment.IssueComment( self._requester, data, completed = True )
|
||||
|
||||
def get_issue_comments( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self._parentUrl( self._parentUrl( self.url ) ) + "/issues/" + str( self.number ) + "/comments",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
IssueComment.IssueComment,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self._parentUrl( self._parentUrl( self.url ) ) + "/issues/" + str( self.number ) + "/comments",
|
||||
None
|
||||
)
|
||||
|
||||
def is_merged( self ):
|
||||
|
||||
+46
-184
@@ -510,17 +510,11 @@ class Repository( GithubObject.GithubObject ):
|
||||
return headers[ "location" ]
|
||||
|
||||
def get_assignees( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/assignees",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
NamedUser.NamedUser,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/assignees",
|
||||
None
|
||||
)
|
||||
|
||||
def get_branch( self, branch ):
|
||||
@@ -534,31 +528,19 @@ class Repository( GithubObject.GithubObject ):
|
||||
return Branch.Branch( self._requester, data, completed = True )
|
||||
|
||||
def get_branches( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/branches",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
Branch.Branch,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/branches",
|
||||
None
|
||||
)
|
||||
|
||||
def get_collaborators( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/collaborators",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
NamedUser.NamedUser,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/collaborators",
|
||||
None
|
||||
)
|
||||
|
||||
def get_comment( self, id ):
|
||||
@@ -572,17 +554,11 @@ class Repository( GithubObject.GithubObject ):
|
||||
return CommitComment.CommitComment( self._requester, data, completed = True )
|
||||
|
||||
def get_comments( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/comments",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
CommitComment.CommitComment,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/comments",
|
||||
None
|
||||
)
|
||||
|
||||
def get_commit( self, sha ):
|
||||
@@ -603,17 +579,11 @@ class Repository( GithubObject.GithubObject ):
|
||||
url_parameters[ "sha" ] = sha
|
||||
if path is not GithubObject.NotSet:
|
||||
url_parameters[ "path" ] = path
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/commits",
|
||||
url_parameters,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
Commit.Commit,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/commits",
|
||||
url_parameters
|
||||
)
|
||||
|
||||
def get_contents( self, path ):
|
||||
@@ -627,17 +597,11 @@ class Repository( GithubObject.GithubObject ):
|
||||
return ContentFile.ContentFile( self._requester, data, completed = True )
|
||||
|
||||
def get_contributors( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/contributors",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
NamedUser.NamedUser,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/contributors",
|
||||
None
|
||||
)
|
||||
|
||||
def get_download( self, id ):
|
||||
@@ -651,45 +615,27 @@ class Repository( GithubObject.GithubObject ):
|
||||
return Download.Download( self._requester, data, completed = True )
|
||||
|
||||
def get_downloads( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/downloads",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
Download.Download,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/downloads",
|
||||
None
|
||||
)
|
||||
|
||||
def get_events( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/events",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
Event.Event,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/events",
|
||||
None
|
||||
)
|
||||
|
||||
def get_forks( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/forks",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
Repository,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/forks",
|
||||
None
|
||||
)
|
||||
|
||||
def get_git_blob( self, sha ):
|
||||
@@ -723,17 +669,11 @@ class Repository( GithubObject.GithubObject ):
|
||||
return GitRef.GitRef( self._requester, data, completed = True )
|
||||
|
||||
def get_git_refs( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/git/refs",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
GitRef.GitRef,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/git/refs",
|
||||
None
|
||||
)
|
||||
|
||||
def get_git_tag( self, sha ):
|
||||
@@ -771,17 +711,11 @@ class Repository( GithubObject.GithubObject ):
|
||||
return Hook.Hook( self._requester, data, completed = True )
|
||||
|
||||
def get_hooks( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/hooks",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
Hook.Hook,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/hooks",
|
||||
None
|
||||
)
|
||||
|
||||
def get_issue( self, number ):
|
||||
@@ -826,17 +760,11 @@ class Repository( GithubObject.GithubObject ):
|
||||
url_parameters[ "direction" ] = direction
|
||||
if since is not GithubObject.NotSet:
|
||||
url_parameters[ "since" ] = since.strftime( "%Y-%m-%dT%H:%M:%SZ" )
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/issues",
|
||||
url_parameters,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
Issue.Issue,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/issues",
|
||||
url_parameters
|
||||
)
|
||||
|
||||
def get_issues_event( self, id ):
|
||||
@@ -850,17 +778,11 @@ class Repository( GithubObject.GithubObject ):
|
||||
return IssueEvent.IssueEvent( self._requester, data, completed = True )
|
||||
|
||||
def get_issues_events( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/issues/events",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
IssueEvent.IssueEvent,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/issues/events",
|
||||
None
|
||||
)
|
||||
|
||||
def get_key( self, id ):
|
||||
@@ -874,17 +796,11 @@ class Repository( GithubObject.GithubObject ):
|
||||
return RepositoryKey.RepositoryKey( self._requester, data, completed = True, repoUrl = self._url )
|
||||
|
||||
def get_keys( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/keys",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
lambda requester, data, completed: RepositoryKey.RepositoryKey( requester, data, completed, repoUrl = self._url ),
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/keys",
|
||||
None
|
||||
)
|
||||
|
||||
def get_label( self, name ):
|
||||
@@ -898,17 +814,11 @@ class Repository( GithubObject.GithubObject ):
|
||||
return Label.Label( self._requester, data, completed = True )
|
||||
|
||||
def get_labels( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/labels",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
Label.Label,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/labels",
|
||||
None
|
||||
)
|
||||
|
||||
def get_languages( self ):
|
||||
@@ -941,31 +851,19 @@ class Repository( GithubObject.GithubObject ):
|
||||
url_parameters[ "sort" ] = sort
|
||||
if direction is not GithubObject.NotSet:
|
||||
url_parameters[ "direction" ] = direction
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/milestones",
|
||||
url_parameters,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
Milestone.Milestone,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/milestones",
|
||||
url_parameters
|
||||
)
|
||||
|
||||
def get_network_events( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
"/networks/" + self.owner.login + "/" + self.name + "/events",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
Event.Event,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
"/networks/" + self.owner.login + "/" + self.name + "/events",
|
||||
None
|
||||
)
|
||||
|
||||
def get_pull( self, number ):
|
||||
@@ -983,17 +881,11 @@ class Repository( GithubObject.GithubObject ):
|
||||
url_parameters = dict()
|
||||
if state is not GithubObject.NotSet:
|
||||
url_parameters[ "state" ] = state
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/pulls",
|
||||
url_parameters,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
PullRequest.PullRequest,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/pulls",
|
||||
url_parameters
|
||||
)
|
||||
|
||||
def get_readme( self ):
|
||||
@@ -1006,73 +898,43 @@ class Repository( GithubObject.GithubObject ):
|
||||
return ContentFile.ContentFile( self._requester, data, completed = True )
|
||||
|
||||
def get_stargazers( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/stargazers",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
NamedUser.NamedUser,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/stargazers",
|
||||
None
|
||||
)
|
||||
|
||||
def get_subscribers( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/subscribers",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
NamedUser.NamedUser,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/subscribers",
|
||||
None
|
||||
)
|
||||
|
||||
def get_tags( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/tags",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
Tag.Tag,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/tags",
|
||||
None
|
||||
)
|
||||
|
||||
def get_teams( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/teams",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
Team.Team,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/teams",
|
||||
None
|
||||
)
|
||||
|
||||
def get_watchers( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/watchers",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
NamedUser.NamedUser,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/watchers",
|
||||
None
|
||||
)
|
||||
|
||||
def has_in_assignees( self, assignee ):
|
||||
|
||||
+4
-16
@@ -91,31 +91,19 @@ class Team( GithubObject.GithubObject ):
|
||||
self._useAttributes( data )
|
||||
|
||||
def get_members( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/members",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
NamedUser.NamedUser,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/members",
|
||||
None
|
||||
)
|
||||
|
||||
def get_repos( self ):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
self.url + "/repos",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PaginatedList.PaginatedList(
|
||||
Repository.Repository,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
self.url + "/repos",
|
||||
None
|
||||
)
|
||||
|
||||
def has_in_members( self, member ):
|
||||
|
||||
@@ -48,6 +48,10 @@ class Github( Framework.TestCase ):
|
||||
repos = self.g.legacy_search_repos( "document" )
|
||||
self.assertListKeyBegin( repos, lambda r: r.name, [ "git", "nimbus", "kss", "sstoolkit", "lawnchair", "appledoc", "jQ.Mobi", "ipython", "mongoengine", "ravendb", "substance", "symfony-docs", "JavaScript-Garden", "DocSets-for-iOS", "yard", "phpDocumentor2", "phpsh", "Tangle", "Ingredients", "documentjs", "xhp", "couchdb-lucene", "dox", "magento2", "javascriptmvc", "FastPdfKit", "roar", "DocumentUp", "NoRM", "jsdoc", "tagger", "mongodb-csharp", "php-github-api", "beautiful-docs", "mongodb-odm", "iodocs", "seesaw", "bcx-api", "developer.github.com", "amqp", "docsplit", "pycco", "standards-and-practices", "tidy-html5", "redis-doc", "tomdoc", "docs", "flourish", "userguide", "swagger-ui", "rfc", "Weasel-Diesel", "yuidoc", "apigen", "document-viewer", "develop.github.com", "Shanty-Mongo", "PTShowcaseViewController", "gravatar_image_tag", "api-wow-docs", "mongoid-tree", "safari-json-formatter", "mayan", "orm-documentation", "jsfiddle-docs-alpha", "core", "documentcloud", "flexible-nav", "writeCapture", "readium", "xmldocument", "Documentation-Examples", "grails-doc", "stdeb", "aws-autoscaling", "voteable_mongo", "review", "spreadsheet_on_rails", "UKSyntaxColoredTextDocument", "mandango", "bdoc", "Documentation", "documents.com", "rghost", "ticket_mule", "vendo", "khan-api", "spring-data-document-examples", "rspec_api_documentation", "axlsx", "phpdox", "documentation", "Sami", "innershiv", "doxyclean", "documents", "rvm-site", "jqapi", "documentation", "hadoopy", "VichUploaderBundle", "pdoc", "documentation", "wii-js", "oss-docs", "scala-maven-plugin", "Documents", "documenter", "behemoth", "documentation", "documentation", "propelorm.github.com", "Kobold2D", "AutoObjectDocumentation", "php-mongodb-admin", "django-mongokit", "puppet-docs", "docs", "Document", "vendorer", "symfony1-docs", "shocco", "documentation", "jog", "docs", "documentation", "documentation", "documentation", "documentation", "Documentation", "documentation", "documentation", "phpunit-documentation", "ADCtheme", "NelmioApiDocBundle", "iCloud-Singleton-CloudMe", "Documentation", "document", "document_mapper", "heroku-docs", "couchdb-odm", "documentation", "documentation", "document", "documentation", "NanoStore", "documentation", "Documentation", "documentation", "Documentation", "documentation", "document", "documentation", "documentation", "Documentation", "Documentation", "grendel", "ceylon-compiler", "mbtiles-spec", "documentation", "documents", "documents", "Documents", "Documentation", "documentation", "Documentation", "documentation", "documents", "Documentation", "documentation", "documentation", "documents", "Documentation", "documentation", "documenter", "documentation", "documents", "Documents", "documents", "documents", "documentation", "Document", "document", "rdoc", "mongoid_token", "travis-ci.github.com", "Documents", "Documents", "documents", "Document", "Documentation", "documents", "Documents", "Documentation", "documents", "documents", "documents", "documentation", "Documents", "Document", "documents", "documents", "Documentation", "Documentation", "Document", "documents", "Documents", "Documents", "Documentation", "Documents", "documents", "Documents", "document", "documents", "Documentation", "Documents", "documents", "documents", "Documents", "documents", "Documentation", "documentation", "Document", "Documents", "documents", "documents", "documents", "Documentation", "Documentation", "Documents", "Documents", "Documents", "Documenter", "document", "Documentation", "Documents", "Documents", "documentation", "documentation", "Document", "Documents", "Documentation", "Documentation", "Documents", "documents", "Documents", "document", "documentation", "Documents", "documentation", "documentation", "documentation", "Documentation", "Documents", "Documents", "documentation", "Documents", "Documents", "documentation", "documentation", "documents", "Documentation", "documents", "documentation", "Documentation", "Documents", "documentation", "documentation", "documents", "documentation", "Umbraco5Docs", "documents", "Documents", "Documentation", "documents", "document", "documents", "document", "documents", "documentation", "Documents", "documents", "document", "Documents", "Documentation", "Documentation", "documentation", "Documentation", "document", "documentation", "documents", "documents", "Documentations", "document", "documentation", "Documentation", "Document", "Documents", "Documents", "Document" ] )
|
||||
|
||||
def testLegacySearchReposExplicitPagination( self ):
|
||||
repos = self.g.legacy_search_repos( "python" )
|
||||
self.assertEqual( [ r.name for r in repos.get_page( 4 ) ], [ "assetic", "cartodb", "cuisine", "gae-sessions", "geoalchemy2", "Multicorn", "wmfr-timeline", "redis-rdb-tools", "applet-workflows", "TweetBuff", "groovy-core", "StarTrekGame", "Nuevo", "Cupid", "node-sqlserver", "Magnet2Torrent", "GroundControl", "mock-django", "4bit", "mock-django", "Fabulous", "SFML", "pydicas", "flixel", "up", "mongrel2", "SimpleHTTPServerJs", "ultimos", "Archipel", "JSbooks", "nova", "nodebox", "simplehttp", "dablooms", "solarized", "landslide", "jQuery-File-Upload", "jQuery-File-Upload", "jQuery-File-Upload", "password-manager", "electrum", "twitter_nlp", "djangbone", "pyxfst", "node-gyp", "flare", "www.gittip.com", "wymeditor", "Kokobox", "MyCQ", "runwalk", "git-sweep", "HPCPythonSC2012", "sundown", "node2dm", "statirator", "fantastic-futures", "chainsaw", "itcursos-gerenciador-tarefas", "TideSDK", "genmaybot", "melpa", "ConnectedWire", "tarantool", "anserindicus_sn", "luvit", "Minecraft-Overviewer", "Iconic", "pyist.net", "wikibok", "mejorenvo-scraper", "NewsBlur", "SocketRocket", "spf13-vim", "IWantToWorkAtGloboCom", "ruby-style-guide", "aery32-refguide", "fafsite", "compsense_demo", "enaml", "mpi4py", "fi.pycon.org", "scikits-image", "scikits-image", "uni", "mako.vim", "mako.vim", "slumber", "de-composer", "nvm", "helloshopply", "Alianza", "vimfiles", "socorro-crashstats", "menu", "analytics", "elFinder", "riak_wiki", "livestreamer", "git-goggles" ] )
|
||||
|
||||
def testLegacySearchReposWithLanguage( self ):
|
||||
repos = self.g.legacy_search_repos( "document", language = "Python" )
|
||||
self.assertListKeyBegin( repos, lambda r: r.name, [ "ipython", "mongoengine", "tagger" ] )
|
||||
@@ -69,6 +73,10 @@ class Github( Framework.TestCase ):
|
||||
def testLegacySearchUsersPagination( self ):
|
||||
self.assertEqual( len( list( self.g.legacy_search_users( "Lucy" ) ) ), 146 )
|
||||
|
||||
def testLegacySearchUsersExplicitPagination( self ):
|
||||
users = self.g.legacy_search_users( "Lucy" )
|
||||
self.assertEqual( [ u.login for u in users.get_page( 1 ) ], [ "lucievh", "lucyim", "Lucief", "RevolverUpstairs", "seriousprogramming", "reicul", "davincidubai", "LucianaNascimentodoPrado", "lucia-huenchunao", "kraji20", "Lucywolo", "Luciel", "sunnysummer", "elush", "oprealuci", "Flika", "lsher", "datadrivenjournalism", "nill2020", "doobi", "lucilu", "deldeldel", "lucianacocca", "lucyli-sfdc", "lucysatchell", "UBM", "kolousek", "lucyzhang", "lmegia", "luisolivo", "Lucyzhen", "Luhzinha", "beautifly", "lucybm96", "BuonocoreL", "lucywilliams", "ZxOxZ", "Motwinb", "johnlucy", "Aquanimation", "alaltaieri", "lucylin", "lucychambers", "JuanSesma", "cdwwebware", "ZachWills" ] )
|
||||
|
||||
def testLegacySearchUserByEmail( self ):
|
||||
user = self.g.legacy_search_user_by_email( "vincent@vincent-jacques.net" )
|
||||
self.assertEqual( user.login, "jacquev6" )
|
||||
|
||||
@@ -21,6 +21,12 @@ class PaginatedList( Framework.TestCase ):
|
||||
def testIteration( self ):
|
||||
self.assertEqual( len( list( self.list ) ), 333 )
|
||||
|
||||
def testSeveralIterations( self ):
|
||||
self.assertEqual( len( list( self.list ) ), 333 )
|
||||
self.assertEqual( len( list( self.list ) ), 333 )
|
||||
self.assertEqual( len( list( self.list ) ), 333 )
|
||||
self.assertEqual( len( list( self.list ) ), 333 )
|
||||
|
||||
def testIntIndexingInFirstPage( self ):
|
||||
self.assertEqual( self.list[ 0 ].id, 4772349 )
|
||||
self.assertEqual( self.list[ 24 ].id, 4286936 )
|
||||
@@ -29,6 +35,12 @@ class PaginatedList( Framework.TestCase ):
|
||||
self.assertEqual( self.list[ 50 ].id, 3911629 )
|
||||
self.assertEqual( self.list[ 74 ].id, 3605277 )
|
||||
|
||||
def testGetFirstPage( self ):
|
||||
self.assertListKeyEqual( self.list.get_page( 0 ), lambda i: i.id, [ 4772349, 4767675, 4758608, 4700182, 4662873, 4608132, 4604661, 4588997, 4557803, 4554058, 4539985, 4507572, 4507492, 4507416, 4447561, 4406584, 4384548, 4383465, 4373361, 4373201, 4370619, 4356530, 4352401, 4317009, 4286936 ] )
|
||||
|
||||
def testGetThirdPage( self ):
|
||||
self.assertListKeyEqual( self.list.get_page( 2 ), lambda i: i.id, [ 3911629, 3911537, 3910580, 3910555, 3910549, 3897090, 3883598, 3856005, 3850655, 3825582, 3813852, 3812318, 3812275, 3807459, 3799872, 3799653, 3795495, 3754055, 3710293, 3662214, 3647640, 3631618, 3627067, 3614231, 3605277 ] )
|
||||
|
||||
def testIntIndexingAfterIteration( self ):
|
||||
self.assertEqual( len( list( self.list ) ), 333 )
|
||||
self.assertEqual( self.list[ 11 ].id, 4507572 )
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user