GeezerVison is showing github.com — Merged pull request #3 from natw/git_data · mpdaugherty/python-github3@8430f64
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: AUTHORS.rst +4-2Lines changed: 4 additions & 2 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -11,8 +11,9 @@ Forked and redesign from Kenneth Reitz's repo | 11 | 11 |
| 12 | 12 | Forked from https://github.com/kennethreitz/python-github3 | 13 | 13 |
| 14 | | -Kenneth Reitz is also the author of the awesome `requests <https://github.com/kennethreitz/requests>`_ library | 15 | | -which `python-github3` needs it | | 14 | +Kenneth Reitz is also the author of the awesome | | 15 | +`requests <https://github.com/kennethreitz/requests>`_ library, which | | 16 | +`python-github3` requires. | 16 | 17 |
| 17 | 18 | Patches and Suggestions | 18 | 19 | ......................... | @@ -21,3 +22,4 @@ Patches and Suggestions | 21 | 22 | - Rok Garbas | 22 | 23 | | 23 | 24 | | | 25 | + |
Collapse file Copy file name to clipboardExpand all lines: README.rst +9-4Lines changed: 9 additions & 4 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -41,11 +41,12 @@ Achievements | 41 | 41 | - `Users service <http://developer.github.com/v3/users/>`_ | 42 | 42 | - `Repos service <http://developer.github.com/v3/repos/>`_ | 43 | 43 | - `Gists service <http://developer.github.com/v3/gists/>`_ | | 44 | +- `Git Data service <http://developer.github.com/v3/git/>`_ | 44 | 45 |
| 45 | 46 | TODO | 46 | 47 | ----- | 47 | 48 |
| 48 | | -- Services: Git Data, Issues, Orgs, Pull Requests, Events | | 49 | +- Services: Issues, Orgs, Pull Requests, Events | 49 | 50 | - Oauth authorization API (service?) | 50 | 51 | - Proxy methods into resources (e.g copitux.followers()) | 51 | 52 |
| @@ -55,8 +56,12 @@ Contribute | 55 | 56 | 1. Fork the `repository <https://github.com/copitux/python-github3>`_ | 56 | 57 | 2. Write a test to cover new feature or to reproduce bug | 57 | 58 | 3. Code with `pep8 <http://www.python.org/dev/peps/pep-0008/>`_ rules | 58 | | -4. Add you to ``AUTHORS`` | | 59 | +4. Add yourself to ``AUTHORS`` | 59 | 60 | 5. Pull request it | 60 | 61 |
| 61 | | -**Note**: I use `nose <http://readthedocs.org/docs/nose/en/latest/>`_ test environment, | 62 | | -with `mock <http://www.voidspace.org.uk/python/mock/>`_ ``pip install nose mock`` | | 62 | +Tests | | 63 | +----- | | 64 | + | | 65 | +Test and docs requirements are listed in ``test_requirements.txt``. | | 66 | +Run ``pip install -r test_requirements.txt`` to install them and ``nosetests`` | | 67 | +to run tests. |
Collapse file Copy file name to clipboard +86Lines changed: 86 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +.. _Git Data service: | | 2 | + | | 3 | +Git Data services | | 4 | +================= | | 5 | + | | 6 | +**Example**:: | | 7 | + | | 8 | + from pygithub3 import Github | | 9 | + | | 10 | + gh = Github(user='someone', repo='some_repo') | | 11 | + | | 12 | + a_blob = gh.git_data.blobs.get('a long sha') | | 13 | + | | 14 | + dev_branch = gh.git_data.references.get('heads/add_a_thing') | | 15 | + | | 16 | + | | 17 | +GitData | | 18 | +------- | | 19 | + | | 20 | +.. autoclass:: pygithub3.services.git_data.GitData | | 21 | + :members: | | 22 | + | | 23 | + .. attribute:: blobs | | 24 | + | | 25 | + :ref:`Blobs service` | | 26 | + | | 27 | + .. attribute:: commits | | 28 | + | | 29 | + :ref:`Commits service` | | 30 | + | | 31 | + .. attribute:: references | | 32 | + | | 33 | + :ref:`References service` | | 34 | + | | 35 | + .. attribute:: tags | | 36 | + | | 37 | + :ref:`Tags service` | | 38 | + | | 39 | + .. attribute:: trees | | 40 | + | | 41 | + :ref:`Trees service` | | 42 | + | | 43 | + | | 44 | +.. _Blobs service: | | 45 | + | | 46 | +Blobs | | 47 | +----- | | 48 | + | | 49 | +.. autoclass:: pygithub3.services.git_data.Blobs | | 50 | + :members: | | 51 | + | | 52 | + | | 53 | +.. _Commits service: | | 54 | + | | 55 | +Commits | | 56 | +------- | | 57 | + | | 58 | +.. autoclass:: pygithub3.services.git_data.Commits | | 59 | + :members: | | 60 | + | | 61 | + | | 62 | +.. _References service: | | 63 | + | | 64 | +References | | 65 | +---------- | | 66 | + | | 67 | +.. autoclass:: pygithub3.services.git_data.References | | 68 | + :members: | | 69 | + | | 70 | + | | 71 | +.. _Tags service: | | 72 | + | | 73 | +Tags | | 74 | +---- | | 75 | + | | 76 | +.. autoclass:: pygithub3.services.git_data.Tags | | 77 | + :members: | | 78 | + | | 79 | + | | 80 | +.. _Trees service: | | 81 | + | | 82 | +Trees | | 83 | +----- | | 84 | + | | 85 | +.. autoclass:: pygithub3.services.git_data.Trees | | 86 | + :members: |
Collapse file Copy file name to clipboardExpand all lines: docs/installation.rst +10-4Lines changed: 10 additions & 4 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -15,15 +15,21 @@ Dependencies | 15 | 15 | Required | 16 | 16 | ......... | 17 | 17 |
| 18 | | -This library only depends on `request library`_ module. | | 18 | +This library depends only on the `requests`_ module. | 19 | 19 |
| 20 | | -If you install ``pygithub3`` with ``pip`` all is done. The best option | | 20 | +If you install ``pygithub3`` with ``pip`` all is done. This is the best option. | 21 | 21 |
| 22 | 22 | Optional | 23 | 23 | ......... | 24 | 24 |
| 25 | | -If you want to run the test suite, you must install `nose`_ and `mock`_ | | 25 | +The test suite uses `nose`_, `mock`_, and `unittest2`_. Compiling the | | 26 | +documentation requires `sphinx`_. | 26 | 27 |
| 27 | | -.. _request library: http://docs.python-requests.org/en/v0.10.6/index.html | | 28 | +Install all of these by running ``pip install -r test_requirements.txt``. Then | | 29 | +just run ``nosetests`` to run the tests. | | 30 | + | | 31 | +.. _requests: http://docs.python-requests.org/en/v0.10.6/index.html | 28 | 32 | .. _nose: http://readthedocs.org/docs/nose/en/latest | 29 | 33 | .. _mock: http://pypi.python.org/pypi/mock | | 34 | +.. _unittest2: http://pypi.python.org/pypi/unittest2 | | 35 | +.. _sphinx: http://sphinx.pocoo.org/ |
Collapse file Copy file name to clipboardExpand all lines: docs/services.rst +1Lines changed: 1 addition & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -72,5 +72,6 @@ List of services | 72 | 72 | users | 73 | 73 | repos | 74 | 74 | gists | | 75 | + git_data | 75 | 76 |
| 76 | 77 | .. _mimetypes: http://developer.github.com/v3/mime |
Collapse file Copy file name to clipboardExpand all lines: pygithub3/github.py +9Lines changed: 9 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -17,9 +17,11 @@ def __init__(self, **config): | 17 | 17 | from pygithub3.services.users import User | 18 | 18 | from pygithub3.services.repos import Repo | 19 | 19 | from pygithub3.services.gists import Gist | | 20 | + from pygithub3.services.git_data import GitData | 20 | 21 | self._users = User(**config) | 21 | 22 | self._repos = Repo(**config) | 22 | 23 | self._gists = Gist(**config) | | 24 | + self._git_data = GitData(**config) | 23 | 25 |
| 24 | 26 | @property | 25 | 27 | def remaining_requests(self): | @@ -47,3 +49,10 @@ def gists(self): | 47 | 49 | :ref:`Gists service <Gists service>` | 48 | 50 | """ | 49 | 51 | return self._gists | | 52 | + | | 53 | + @property | | 54 | + def git_data(self): | | 55 | + """ | | 56 | + :ref:`Git Data service <Git Data service>` | | 57 | + """ | | 58 | + return self._git_data |
Collapse file Copy file name to clipboardExpand all lines: pygithub3/requests/git_data/__init__.py Collapse file Copy file name to clipboard +18Lines changed: 18 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +# -*- encoding: utf-8 -*- | | 2 | + | | 3 | +from pygithub3.requests.base import Request | | 4 | +from pygithub3.resources.git_data import Blob | | 5 | + | | 6 | + | | 7 | +class Get(Request): | | 8 | + uri = 'repos/{user}/{repo}/git/blobs/{sha}' | | 9 | + resource = Blob | | 10 | + | | 11 | + | | 12 | +class Create(Request): | | 13 | + uri = 'repos/{user}/{repo}/git/blobs' | | 14 | + resource = Blob | | 15 | + body_schema = { | | 16 | + 'schema': ('content', 'encoding'), | | 17 | + 'required': ('content', 'encoding'), # TODO: is enc really required? | | 18 | + } |
Collapse file Copy file name to clipboard +18Lines changed: 18 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +# -*- encoding: utf-8 -*- | | 2 | + | | 3 | +from pygithub3.requests.base import Request | | 4 | +from pygithub3.resources.git_data import Commit | | 5 | + | | 6 | + | | 7 | +class Get(Request): | | 8 | + uri = 'repos/{user}/{repo}/git/commits/{sha}' | | 9 | + resource = Commit | | 10 | + | | 11 | + | | 12 | +class Create(Request): | | 13 | + uri = 'repos/{user}/{repo}/git/commits' | | 14 | + resource = Commit | | 15 | + body_schema = { | | 16 | + 'schema': ('message', 'tree', 'parents', 'author', 'committer'), | | 17 | + 'required': ('message', 'tree', 'parents'), | | 18 | + } |
Collapse file Copy file name to clipboard +33Lines changed: 33 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +from pygithub3.requests.base import Request | | 2 | +from pygithub3.resources.git_data import Reference | | 3 | + | | 4 | + | | 5 | +class Get(Request): | | 6 | + uri = 'repos/{user}/{repo}/git/refs/{ref}' | | 7 | + resource = Reference | | 8 | + | | 9 | + | | 10 | +class List(Request): | | 11 | + uri = 'repos/{user}/{repo}/git/refs' | | 12 | + resource = Reference | | 13 | + | | 14 | + | | 15 | +class Create(Request): | | 16 | + uri = 'repos/{user}/{repo}/git/refs' | | 17 | + resource = Reference | | 18 | + body_schema = { | | 19 | + 'schema': ('ref', 'sha'), | | 20 | + 'required': ('ref', 'sha'), | | 21 | + } | | 22 | + | | 23 | +class Update(Request): | | 24 | + uri = 'repos/{user}/{repo}/git/refs/{ref}' | | 25 | + resource = Reference | | 26 | + body_schema = { | | 27 | + 'schema': ('sha', 'force'), | | 28 | + 'required': ('sha',), | | 29 | + } | | 30 | + | | 31 | + | | 32 | +class Delete(Request): | | 33 | + uri = 'repos/{user}/{repo}/git/refs/{ref}' |
|