From e3ef6bc59d77adaaa358aa78d3c9b891852e1bb9 Mon Sep 17 00:00:00 2001 From: James Rowe Date: Wed, 16 May 2012 15:31:49 +0100 Subject: [PATCH] Added some more missing docstrings. --- github2/client.py | 5 +++-- github2/commits.py | 6 ++++++ github2/core.py | 14 +++++++++++--- github2/issues.py | 9 +++++++++ github2/organizations.py | 16 ++++++++++++++-- github2/pull_requests.py | 6 ++++-- github2/repositories.py | 5 +++++ github2/request.py | 11 +++++++---- github2/teams.py | 12 ++++++++++-- github2/users.py | 9 +++++++++ 10 files changed, 78 insertions(+), 15 deletions(-) diff --git a/github2/client.py b/github2/client.py index 0296be4..5cf8d7e 100644 --- a/github2/client.py +++ b/github2/client.py @@ -10,11 +10,12 @@ class Github(object): + """Interface to GitHub's API v2.""" + def __init__(self, username=None, api_token=None, requests_per_second=None, access_token=None, cache=None, proxy_host=None, proxy_port=8080, github_url=None): - """An interface to GitHub's API: - http://develop.github.com/ + """Setup GitHub API object. .. versionadded:: 0.2.0 The ``requests_per_second`` parameter diff --git a/github2/commits.py b/github2/commits.py index 2bfd152..a04892f 100644 --- a/github2/commits.py +++ b/github2/commits.py @@ -3,6 +3,9 @@ class Commit(BaseData): + + """Commit container.""" + message = Attribute("Commit message.") parents = Attribute("List of parents for this commit.") url = Attribute("Canonical URL for this commit.") @@ -25,6 +28,9 @@ def __repr__(self): class Commits(GithubCommand): + + """GitHub API commits functionality.""" + domain = "commits" def list(self, project, branch="master", file=None, page=1): diff --git a/github2/core.py b/github2/core.py index 9329e5e..807aa93 100644 --- a/github2/core.py +++ b/github2/core.py @@ -143,8 +143,10 @@ def enhanced_by_auth(f): class GithubCommand(object): + """Main API binding interface.""" + def __init__(self, request): - """Main API binding interface. + """Setup command object. :param github2.request.GithubRequest request: HTTP request handler @@ -244,8 +246,11 @@ def bullet(title, text): class Attribute(object): + + """Generic object attribute for use with :class:`BaseData`.""" + def __init__(self, help): - """Generic object attribute for use with :class:`BaseData`. + """Setup Attribute object. :param str help: Attribute description @@ -259,6 +264,9 @@ def to_python(self, value): class DateAttribute(Attribute): + + """Date handling attribute for use with :class:`BaseData`.""" + format = "github" converter_for_format = { "github": datetime_to_ghdate, @@ -268,7 +276,7 @@ class DateAttribute(Attribute): } def __init__(self, *args, **kwargs): - """Date handling attribute for use with :class:`BaseData`. + """Setup DateAttribute object. :param str format: The date format to support, see :data:`convertor_for_format` for supported options diff --git a/github2/issues.py b/github2/issues.py index 0f72908..89dcf17 100644 --- a/github2/issues.py +++ b/github2/issues.py @@ -8,6 +8,9 @@ class Issue(BaseData): + + """Issue container.""" + position = Attribute("The position of this issue in a list.") number = Attribute("The issue number (unique for project).") votes = Attribute("Number of votes for this issue.") @@ -28,6 +31,9 @@ def __repr__(self): class Comment(BaseData): + + """Comment container.""" + created_at = DateAttribute("The date this comment was created.") updated_at = DateAttribute("The date when this comment was last updated.") body = Attribute("The full text of this comment.") @@ -39,6 +45,9 @@ def __repr__(self): class Issues(GithubCommand): + + """GitHub API issues functionality.""" + domain = "issues" def search(self, project, term, state="open"): diff --git a/github2/organizations.py b/github2/organizations.py index 263990b..3ac66c1 100644 --- a/github2/organizations.py +++ b/github2/organizations.py @@ -6,7 +6,13 @@ class Organization(BaseData): - """.. versionadded:: 0.4.0""" + + """Organization container. + + .. versionadded:: 0.4.0 + + """ + id = Attribute("The organization id.") name = Attribute("The full name of the organization.") blog = Attribute("The organization's blog.") @@ -35,7 +41,13 @@ def __repr__(self): class Organizations(GithubCommand): - """.. versionadded:: 0.4.0""" + + """GitHub API organizations functionality. + + .. versionadded:: 0.4.0 + + """ + domain = "organizations" def show(self, organization): diff --git a/github2/pull_requests.py b/github2/pull_requests.py index bc82814..b168b66 100644 --- a/github2/pull_requests.py +++ b/github2/pull_requests.py @@ -3,7 +3,8 @@ class PullRequest(BaseData): - """Pull request encapsulation. + + """Pull request container. .. versionadded:: 0.5.0 @@ -42,7 +43,8 @@ def __repr__(self): class PullRequests(GithubCommand): - """Operations on pull requests. + + """GitHub API pull request functionality. .. versionadded:: 0.5.0 diff --git a/github2/repositories.py b/github2/repositories.py index c515955..10f07a0 100644 --- a/github2/repositories.py +++ b/github2/repositories.py @@ -5,6 +5,9 @@ class Repository(BaseData): + + """Repository container.""" + name = Attribute("Name of repository.") description = Attribute("Repository description.") forks = Attribute("Number of forks of this repository.") @@ -35,6 +38,8 @@ def __repr__(self): class Repositories(GithubCommand): + """GitHub API repository functionality.""" + domain = "repos" def search(self, query): diff --git a/github2/request.py b/github2/request.py index 8ccfe39..6dcb371 100644 --- a/github2/request.py +++ b/github2/request.py @@ -111,6 +111,13 @@ def __init__(self, message, content, code): class GithubRequest(object): + + """Make an API request. + + :see: :class:`github2.client.Github` + + """ + url_format = "%(github_url)s/api/%(api_version)s/%(api_format)s" api_version = "v2" api_format = "json" @@ -120,10 +127,6 @@ def __init__(self, username=None, api_token=None, url_prefix=None, requests_per_second=None, access_token=None, cache=None, proxy_host=None, proxy_port=None, github_url=None): - """Make an API request. - - :see: :class:`github2.client.Github` - """ self.username = username self.api_token = api_token self.access_token = access_token diff --git a/github2/teams.py b/github2/teams.py index 0feb720..7c44e86 100644 --- a/github2/teams.py +++ b/github2/teams.py @@ -5,7 +5,11 @@ class Team(BaseData): - """.. versionadded:: 0.4.0""" + """Team container. + + .. versionadded:: 0.4.0 + + """ id = Attribute("The team id") name = Attribute("Name of the team") @@ -17,7 +21,11 @@ def __repr__(self): class Teams(GithubCommand): - """.. versionadded:: 0.4.0""" + """GitHub API teams functionality. + + .. versionadded:: 0.4.0 + + """ domain = "teams" diff --git a/github2/users.py b/github2/users.py index 65d7702..4ea8c2d 100644 --- a/github2/users.py +++ b/github2/users.py @@ -8,6 +8,9 @@ class Key(BaseData): + + """SSH key container.""" + id = Attribute('The key id') key = Attribute('The SSH key data') title = Attribute('The title for the SSH key') @@ -17,6 +20,9 @@ def __repr__(self): class User(BaseData): + + """GitHub user container.""" + id = Attribute("The user id") login = Attribute("The login username") name = Attribute("The users full name") @@ -53,6 +59,9 @@ def __repr__(self): class Users(GithubCommand): + + """GitHub API user functionality.""" + domain = "user" def search(self, query):