Skip to content

Commit

Permalink
Added some more missing docstrings.
Browse files Browse the repository at this point in the history
  • Loading branch information
JNRowe committed May 16, 2012
1 parent 4902ffc commit e3ef6bc
Show file tree
Hide file tree
Showing 10 changed files with 78 additions and 15 deletions.
5 changes: 3 additions & 2 deletions github2/client.py
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions github2/commits.py
Expand Up @@ -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.")
Expand All @@ -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):
Expand Down
14 changes: 11 additions & 3 deletions github2/core.py
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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,
Expand All @@ -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
Expand Down
9 changes: 9 additions & 0 deletions github2/issues.py
Expand Up @@ -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.")
Expand All @@ -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.")
Expand All @@ -39,6 +45,9 @@ def __repr__(self):


class Issues(GithubCommand):

"""GitHub API issues functionality."""

domain = "issues"

def search(self, project, term, state="open"):
Expand Down
16 changes: 14 additions & 2 deletions github2/organizations.py
Expand Up @@ -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.")
Expand Down Expand Up @@ -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):
Expand Down
6 changes: 4 additions & 2 deletions github2/pull_requests.py
Expand Up @@ -3,7 +3,8 @@


class PullRequest(BaseData):
"""Pull request encapsulation.

"""Pull request container.
.. versionadded:: 0.5.0
Expand Down Expand Up @@ -42,7 +43,8 @@ def __repr__(self):


class PullRequests(GithubCommand):
"""Operations on pull requests.

"""GitHub API pull request functionality.
.. versionadded:: 0.5.0
Expand Down
5 changes: 5 additions & 0 deletions github2/repositories.py
Expand Up @@ -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.")
Expand Down Expand Up @@ -35,6 +38,8 @@ def __repr__(self):


class Repositories(GithubCommand):
"""GitHub API repository functionality."""

domain = "repos"

def search(self, query):
Expand Down
11 changes: 7 additions & 4 deletions github2/request.py
Expand Up @@ -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"
Expand All @@ -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
Expand Down
12 changes: 10 additions & 2 deletions github2/teams.py
Expand Up @@ -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")
Expand All @@ -17,7 +21,11 @@ def __repr__(self):

class Teams(GithubCommand):

""".. versionadded:: 0.4.0"""
"""GitHub API teams functionality.
.. versionadded:: 0.4.0
"""

domain = "teams"

Expand Down
9 changes: 9 additions & 0 deletions github2/users.py
Expand Up @@ -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')
Expand All @@ -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")
Expand Down Expand Up @@ -53,6 +59,9 @@ def __repr__(self):


class Users(GithubCommand):

"""GitHub API user functionality."""

domain = "user"

def search(self, query):
Expand Down

0 comments on commit e3ef6bc

Please sign in to comment.