forked from sigmavirus24/github3.py
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgist
More file actions
1 lines (1 loc) · 10.8 KB
/
Copy pathgist
File metadata and controls
1 lines (1 loc) · 10.8 KB
1
{"files": {"recipe.py": {"raw_url": "https://gist.github.com/raw/3813862/ff60a9f54f16d651c8ba40441cace6259c1d8c1a/recipe.py", "language": "Python", "filename": "recipe.py", "content": "\"\"\"\nAn example of how to transform a list function an iter function\n\"\"\"\n\ndef list_network_events(self):\n \"\"\"Doc-string starting with the verb \"List\"\n\n :returns: list of :class:`Event <github3.events.Event>`\n \"\"\"\n url = self._build_url(\"...\")\n # request\n return [\"Events\"]\n\ndef iter_network_events(self, number=-1):\n \"\"\"Same doc-string as above replacing \"List\" with \"Iterates over\"\n\n :param int number: (optional), number of network events to return. Default: -1 returns all available network events.\n :returns: generator of :class:`Event <github3.events.Event>`\n \"\"\"\n url = self._build_url(\"...\")\n return self._iter(int(number), url, Event)\n\n# If the class you're using inherits directly from GitHubObject instead of GitHubCore, you set the last parameter to False.\n# Also in the equivalent tests/test_(mod_name).py file, make a test next to the list function for the iter_function. An example test is:\n\ndef test_iter_network_events(self):\n expect(next(self.repo.iter_network_events(1))).isinstance(Event)\n\n# If the function takes other parameters, a test for those parameters individually or in bulk can be added as well.\n# e.g., list_milestones() -> iter_milestones() can have\n\ndef test_iter_milestones(self):\n expect(next(self.repo.iter_milestones(number=1))).isinstance(Event)\n expect(next(self.repo.iter_milestones(state='open', number=1))).isinstance(Event)\n # once more for the remaining two OR just\n expect(next(self.repo.iter_milestones('open', 'sort_param', 'asc', 1))).isinstance(Event)", "type": "application/python", "size": 1549}, "gistfile1.txt": {"raw_url": "https://gist.github.com/raw/3813862/e59fc7d730b04ef1b2b224897b72d284ec87facf/gistfile1.txt", "language": null, "filename": "gistfile1.txt", "content": "github3/api.py:45:def list_gists(username=None):\ngithub3/api.py:55:def list_followers(username):\ngithub3/api.py:64:def list_following(username):\ngithub3/api.py:72:def list_repo_issues(owner, repository, filter='', state='', l\nabels='',\ngithub3/api.py:82:def list_orgs(username):\ngithub3/api.py:90:def list_repos(login, type='', sort='', direction=''):\ngithub3/api.py:118:def list_events():\n\ngithub3/github.py:318: def list_authorizations(self):\ngithub3/github.py:327: def list_emails(self):\ngithub3/github.py:336: def list_events(self):\ngithub3/github.py:345: def list_followers(self, login=None):\ngithub3/github.py:358: def list_following(self, login=None):\ngithub3/github.py:371: def list_gists(self, username=None):\ngithub3/github.py:387: def list_user_issues(self, filter='', state='', labels\n='', sort='',\ngithub3/github.py:411: def list_repo_issues(self, owner, repository, mileston\ne=None,\ngithub3/github.py:442: def list_keys(self):\ngithub3/github.py:451: def list_orgs(self, login=None):\ngithub3/github.py:468: def list_repos(self, login=None, type='', sort='', dir\nection=''):\ngithub3/github.py:507: def list_starred(self, login=None):\ngithub3/github.py:519: def list_subscribed(self, login=None):\ngithub3/github.py:532: def list_watching(self, login=None):\n\ngithub3/repos.py:826: def list_assignees(self):\ngithub3/repos.py:835: def list_branches(self):\ngithub3/repos.py:845: def list_comments(self):\ngithub3/repos.py:855: def list_comments_on_commit(self, sha):\ngithub3/repos.py:870: def list_commits(self, sha='', path='', author=''):\ngithub3/repos.py:887: def list_contributors(self, anon=False):\ngithub3/repos.py:902: def list_downloads(self):\ngithub3/repos.py:912: def list_events(self):\ngithub3/repos.py:922: def list_forks(self, sort=''):\ngithub3/repos.py:939: def list_hooks(self):\ngithub3/repos.py:949: def list_issues(self,", "type": "text/plain", "size": 1918}}, "commits_url": "https://api.github.com/gists/3813862/commits", "forks_url": "https://api.github.com/gists/3813862/forks", "description": "List of places to replace list functions with iter functions", "url": "https://api.github.com/gists/3813862", "created_at": "2012-10-01T19:23:44Z", "comments_url": "https://api.github.com/gists/3813862/comments", "html_url": "https://gist.github.com/3813862", "comments": 0, "public": true, "updated_at": "2012-10-01T19:23:44Z", "user": {"following_url": "https://api.github.com/users/sigmavirus24/following{/other_user}", "events_url": "https://api.github.com/users/sigmavirus24/events{/privacy}", "organizations_url": "https://api.github.com/users/sigmavirus24/orgs", "url": "https://api.github.com/users/sigmavirus24", "gists_url": "https://api.github.com/users/sigmavirus24/gists{/gist_id}", "html_url": "https://github.com/sigmavirus24", "subscriptions_url": "https://api.github.com/users/sigmavirus24/subscriptions", "avatar_url": "https://secure.gravatar.com/avatar/c148356d89f925e692178bee1d93acf7?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png", "repos_url": "https://api.github.com/users/sigmavirus24/repos", "received_events_url": "https://api.github.com/users/sigmavirus24/received_events", "gravatar_id": "c148356d89f925e692178bee1d93acf7", "starred_url": "https://api.github.com/users/sigmavirus24/starred{/owner}{/repo}", "login": "sigmavirus24", "type": "User", "id": 240830, "followers_url": "https://api.github.com/users/sigmavirus24/followers"}, "git_pull_url": "https://gist.github.com/3813862.git", "git_push_url": "https://gist.github.com/3813862.git", "forks": [], "id": "3813862", "history": [{"change_status": {"deletions": 7, "additions": 1, "total": 8}, "url": "https://api.github.com/gists/3813862/8d6121ba316f3d07371183e526b5287474d81bcc", "committed_at": "2012-10-02T00:04:49Z", "version": "8d6121ba316f3d07371183e526b5287474d81bcc", "user": {"following_url": "https://api.github.com/users/sigmavirus24/following{/other_user}", "events_url": "https://api.github.com/users/sigmavirus24/events{/privacy}", "organizations_url": "https://api.github.com/users/sigmavirus24/orgs", "url": "https://api.github.com/users/sigmavirus24", "gists_url": "https://api.github.com/users/sigmavirus24/gists{/gist_id}", "html_url": "https://github.com/sigmavirus24", "subscriptions_url": "https://api.github.com/users/sigmavirus24/subscriptions", "avatar_url": "https://secure.gravatar.com/avatar/c148356d89f925e692178bee1d93acf7?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png", "repos_url": "https://api.github.com/users/sigmavirus24/repos", "received_events_url": "https://api.github.com/users/sigmavirus24/received_events", "gravatar_id": "c148356d89f925e692178bee1d93acf7", "starred_url": "https://api.github.com/users/sigmavirus24/starred{/owner}{/repo}", "login": "sigmavirus24", "type": "User", "id": 240830, "followers_url": "https://api.github.com/users/sigmavirus24/followers"}}, {"change_status": {"deletions": 10, "additions": 1, "total": 11}, "url": "https://api.github.com/gists/3813862/a2a4a7b438cea5aafb60e82da28569fa44582b14", "committed_at": "2012-10-01T20:54:57Z", "version": "a2a4a7b438cea5aafb60e82da28569fa44582b14", "user": {"following_url": "https://api.github.com/users/sigmavirus24/following{/other_user}", "events_url": "https://api.github.com/users/sigmavirus24/events{/privacy}", "organizations_url": "https://api.github.com/users/sigmavirus24/orgs", "url": "https://api.github.com/users/sigmavirus24", "gists_url": "https://api.github.com/users/sigmavirus24/gists{/gist_id}", "html_url": "https://github.com/sigmavirus24", "subscriptions_url": "https://api.github.com/users/sigmavirus24/subscriptions", "avatar_url": "https://secure.gravatar.com/avatar/c148356d89f925e692178bee1d93acf7?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png", "repos_url": "https://api.github.com/users/sigmavirus24/repos", "received_events_url": "https://api.github.com/users/sigmavirus24/received_events", "gravatar_id": "c148356d89f925e692178bee1d93acf7", "starred_url": "https://api.github.com/users/sigmavirus24/starred{/owner}{/repo}", "login": "sigmavirus24", "type": "User", "id": 240830, "followers_url": "https://api.github.com/users/sigmavirus24/followers"}}, {"change_status": {"deletions": 2, "additions": 0, "total": 2}, "url": "https://api.github.com/gists/3813862/e578b4ea38b953ff0fa1397fb04e7ad9563b3d40", "committed_at": "2012-10-01T20:20:13Z", "version": "e578b4ea38b953ff0fa1397fb04e7ad9563b3d40", "user": {"following_url": "https://api.github.com/users/sigmavirus24/following{/other_user}", "events_url": "https://api.github.com/users/sigmavirus24/events{/privacy}", "organizations_url": "https://api.github.com/users/sigmavirus24/orgs", "url": "https://api.github.com/users/sigmavirus24", "gists_url": "https://api.github.com/users/sigmavirus24/gists{/gist_id}", "html_url": "https://github.com/sigmavirus24", "subscriptions_url": "https://api.github.com/users/sigmavirus24/subscriptions", "avatar_url": "https://secure.gravatar.com/avatar/c148356d89f925e692178bee1d93acf7?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png", "repos_url": "https://api.github.com/users/sigmavirus24/repos", "received_events_url": "https://api.github.com/users/sigmavirus24/received_events", "gravatar_id": "c148356d89f925e692178bee1d93acf7", "starred_url": "https://api.github.com/users/sigmavirus24/starred{/owner}{/repo}", "login": "sigmavirus24", "type": "User", "id": 240830, "followers_url": "https://api.github.com/users/sigmavirus24/followers"}}, {"change_status": {"deletions": 0, "additions": 91, "total": 91}, "url": "https://api.github.com/gists/3813862/da3ae2b8d1f4b7bd2c067d02defd4d0f3352854c", "committed_at": "2012-10-01T19:23:45Z", "version": "da3ae2b8d1f4b7bd2c067d02defd4d0f3352854c", "user": {"following_url": "https://api.github.com/users/sigmavirus24/following{/other_user}", "events_url": "https://api.github.com/users/sigmavirus24/events{/privacy}", "organizations_url": "https://api.github.com/users/sigmavirus24/orgs", "url": "https://api.github.com/users/sigmavirus24", "gists_url": "https://api.github.com/users/sigmavirus24/gists{/gist_id}", "html_url": "https://github.com/sigmavirus24", "subscriptions_url": "https://api.github.com/users/sigmavirus24/subscriptions", "avatar_url": "https://secure.gravatar.com/avatar/c148356d89f925e692178bee1d93acf7?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png", "repos_url": "https://api.github.com/users/sigmavirus24/repos", "received_events_url": "https://api.github.com/users/sigmavirus24/received_events", "gravatar_id": "c148356d89f925e692178bee1d93acf7", "starred_url": "https://api.github.com/users/sigmavirus24/starred{/owner}{/repo}", "login": "sigmavirus24", "type": "User", "id": 240830, "followers_url": "https://api.github.com/users/sigmavirus24/followers"}}]}