From 3a52231c943bc59b1ddc8800f96179cbe0d1523d Mon Sep 17 00:00:00 2001 From: David Medina Date: Tue, 3 Apr 2012 12:37:18 +0200 Subject: services.gists.Gist done --- pygithub3/github.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'pygithub3/github.py') diff --git a/pygithub3/github.py b/pygithub3/github.py index 23b5b0b..1cf9b05 100644 --- a/pygithub3/github.py +++ b/pygithub3/github.py @@ -15,8 +15,10 @@ class Github(object): def __init__(self, **config): from pygithub3.services.users import User from pygithub3.services.repos import Repos + from pygithub3.services.gists import Gist self._users = User(**config) self._repos = Repos(**config) + self._gists = Gist(**config) @property def remaining_requests(self): @@ -37,3 +39,10 @@ class Github(object): :ref:`Repos service ` """ return self._repos + + @property + def gists(self): + """ + :ref:`Gist service ` + """ + return self._gists -- cgit v1.2.3-59-g8ed1b From 1abcce9551c83f3ad00303a8d4ef555c9c62f8a4 Mon Sep 17 00:00:00 2001 From: David Medina Date: Tue, 3 Apr 2012 23:16:49 +0200 Subject: Fix naming --- docs/repos.rst | 4 ++-- docs/users.rst | 4 ++-- pygithub3/github.py | 9 +++++---- pygithub3/services/repos/__init__.py | 6 +++--- pygithub3/tests/services/test_repos.py | 4 ++-- 5 files changed, 14 insertions(+), 13 deletions(-) (limited to 'pygithub3/github.py') diff --git a/docs/repos.rst b/docs/repos.rst index 79e016a..c065671 100644 --- a/docs/repos.rst +++ b/docs/repos.rst @@ -1,6 +1,6 @@ .. _Repos service: -Repos's services +Repos services =================== **Fast sample**:: @@ -50,7 +50,7 @@ You can see it better with an example: :: Repo ------- -.. autoclass:: pygithub3.services.repos.Repos +.. autoclass:: pygithub3.services.repos.Repo :members: .. attribute:: collaborators diff --git a/docs/users.rst b/docs/users.rst index 5bd2e97..139d726 100644 --- a/docs/users.rst +++ b/docs/users.rst @@ -1,6 +1,6 @@ -.. _User service: +.. _Users service: -User's services +Users services =============== **Fast sample**:: diff --git a/pygithub3/github.py b/pygithub3/github.py index 1cf9b05..0b302a1 100644 --- a/pygithub3/github.py +++ b/pygithub3/github.py @@ -2,6 +2,7 @@ # -*- encoding: utf-8 -*- +#TODO: Move the imports out. setup related class Github(object): """ You can preconfigure all services globally with a ``config`` dict. See @@ -14,10 +15,10 @@ class Github(object): def __init__(self, **config): from pygithub3.services.users import User - from pygithub3.services.repos import Repos + from pygithub3.services.repos import Repo from pygithub3.services.gists import Gist self._users = User(**config) - self._repos = Repos(**config) + self._repos = Repo(**config) self._gists = Gist(**config) @property @@ -29,7 +30,7 @@ class Github(object): @property def users(self): """ - :ref:`User service ` + :ref:`Users service ` """ return self._users @@ -43,6 +44,6 @@ class Github(object): @property def gists(self): """ - :ref:`Gist service ` + :ref:`Gists service ` """ return self._gists diff --git a/pygithub3/services/repos/__init__.py b/pygithub3/services/repos/__init__.py index 3ef1fb4..628e9d6 100644 --- a/pygithub3/services/repos/__init__.py +++ b/pygithub3/services/repos/__init__.py @@ -11,7 +11,7 @@ from .watchers import Watchers from .hooks import Hooks -class Repos(Service): +class Repo(Service): """ Consume `Repos API `_ """ def __init__(self, **config): @@ -22,7 +22,7 @@ class Repos(Service): self.keys = Keys(**config) self.watchers = Watchers(**config) self.hooks = Hooks(**config) - super(Repos, self).__init__(**config) + super(Repo, self).__init__(**config) def list(self, user=None, type='all'): """ Get user's repositories @@ -133,7 +133,7 @@ class Repos(Service): return self.__list_contributors(user, repo) def list_contributors_with_anonymous(self, user=None, repo=None): - """ Like :attr:`~pygithub3.services.repos.Repos.list_contributors` plus + """ Like :attr:`~pygithub3.services.repos.Repo.list_contributors` plus anonymous """ return self.__list_contributors(user, repo, anom=True) diff --git a/pygithub3/tests/services/test_repos.py b/pygithub3/tests/services/test_repos.py index e77cc90..e21d474 100644 --- a/pygithub3/tests/services/test_repos.py +++ b/pygithub3/tests/services/test_repos.py @@ -5,7 +5,7 @@ import requests from mock import patch, Mock from pygithub3.tests.utils.core import TestCase -from pygithub3.services.repos import (Repos, Collaborators, Commits, Downloads, +from pygithub3.services.repos import (Repo, Collaborators, Commits, Downloads, Forks, Keys, Watchers, Hooks) from pygithub3.resources.base import json from pygithub3.tests.utils.base import (mock_response, mock_response_result, @@ -20,7 +20,7 @@ json.loads = Mock(side_effect=mock_json) class TestRepoService(TestCase): def setUp(self): - self.rs = Repos() + self.rs = Repo() self.rs.set_user('octocat') self.rs.set_repo('octocat_repo') -- cgit v1.2.3-59-g8ed1b