Skip to content

Commit e3ef6bc

Browse files
committed
Added some more missing docstrings.
1 parent 4902ffc commit e3ef6bc

10 files changed

Lines changed: 78 additions & 15 deletions

File tree

github2/client.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@
1010

1111
class Github(object):
1212

13+
"""Interface to GitHub's API v2."""
14+
1315
def __init__(self, username=None, api_token=None, requests_per_second=None,
1416
access_token=None, cache=None, proxy_host=None,
1517
proxy_port=8080, github_url=None):
16-
"""An interface to GitHub's API:
17-
http://develop.github.com/
18+
"""Setup GitHub API object.
1819
1920
.. versionadded:: 0.2.0
2021
The ``requests_per_second`` parameter

github2/commits.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33

44

55
class Commit(BaseData):
6+
7+
"""Commit container."""
8+
69
message = Attribute("Commit message.")
710
parents = Attribute("List of parents for this commit.")
811
url = Attribute("Canonical URL for this commit.")
@@ -25,6 +28,9 @@ def __repr__(self):
2528

2629

2730
class Commits(GithubCommand):
31+
32+
"""GitHub API commits functionality."""
33+
2834
domain = "commits"
2935

3036
def list(self, project, branch="master", file=None, page=1):

github2/core.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,10 @@ def enhanced_by_auth(f):
143143

144144
class GithubCommand(object):
145145

146+
"""Main API binding interface."""
147+
146148
def __init__(self, request):
147-
"""Main API binding interface.
149+
"""Setup command object.
148150
149151
:param github2.request.GithubRequest request: HTTP request handler
150152
@@ -244,8 +246,11 @@ def bullet(title, text):
244246

245247

246248
class Attribute(object):
249+
250+
"""Generic object attribute for use with :class:`BaseData`."""
251+
247252
def __init__(self, help):
248-
"""Generic object attribute for use with :class:`BaseData`.
253+
"""Setup Attribute object.
249254
250255
:param str help: Attribute description
251256
@@ -259,6 +264,9 @@ def to_python(self, value):
259264

260265

261266
class DateAttribute(Attribute):
267+
268+
"""Date handling attribute for use with :class:`BaseData`."""
269+
262270
format = "github"
263271
converter_for_format = {
264272
"github": datetime_to_ghdate,
@@ -268,7 +276,7 @@ class DateAttribute(Attribute):
268276
}
269277

270278
def __init__(self, *args, **kwargs):
271-
"""Date handling attribute for use with :class:`BaseData`.
279+
"""Setup DateAttribute object.
272280
273281
:param str format: The date format to support, see
274282
:data:`convertor_for_format` for supported options

github2/issues.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88

99

1010
class Issue(BaseData):
11+
12+
"""Issue container."""
13+
1114
position = Attribute("The position of this issue in a list.")
1215
number = Attribute("The issue number (unique for project).")
1316
votes = Attribute("Number of votes for this issue.")
@@ -28,6 +31,9 @@ def __repr__(self):
2831

2932

3033
class Comment(BaseData):
34+
35+
"""Comment container."""
36+
3137
created_at = DateAttribute("The date this comment was created.")
3238
updated_at = DateAttribute("The date when this comment was last updated.")
3339
body = Attribute("The full text of this comment.")
@@ -39,6 +45,9 @@ def __repr__(self):
3945

4046

4147
class Issues(GithubCommand):
48+
49+
"""GitHub API issues functionality."""
50+
4251
domain = "issues"
4352

4453
def search(self, project, term, state="open"):

github2/organizations.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@
66

77

88
class Organization(BaseData):
9-
""".. versionadded:: 0.4.0"""
9+
10+
"""Organization container.
11+
12+
.. versionadded:: 0.4.0
13+
14+
"""
15+
1016
id = Attribute("The organization id.")
1117
name = Attribute("The full name of the organization.")
1218
blog = Attribute("The organization's blog.")
@@ -35,7 +41,13 @@ def __repr__(self):
3541

3642

3743
class Organizations(GithubCommand):
38-
""".. versionadded:: 0.4.0"""
44+
45+
"""GitHub API organizations functionality.
46+
47+
.. versionadded:: 0.4.0
48+
49+
"""
50+
3951
domain = "organizations"
4052

4153
def show(self, organization):

github2/pull_requests.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33

44

55
class PullRequest(BaseData):
6-
"""Pull request encapsulation.
6+
7+
"""Pull request container.
78
89
.. versionadded:: 0.5.0
910
@@ -42,7 +43,8 @@ def __repr__(self):
4243

4344

4445
class PullRequests(GithubCommand):
45-
"""Operations on pull requests.
46+
47+
"""GitHub API pull request functionality.
4648
4749
.. versionadded:: 0.5.0
4850

github2/repositories.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55

66

77
class Repository(BaseData):
8+
9+
"""Repository container."""
10+
811
name = Attribute("Name of repository.")
912
description = Attribute("Repository description.")
1013
forks = Attribute("Number of forks of this repository.")
@@ -35,6 +38,8 @@ def __repr__(self):
3538

3639

3740
class Repositories(GithubCommand):
41+
"""GitHub API repository functionality."""
42+
3843
domain = "repos"
3944

4045
def search(self, query):

github2/request.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,13 @@ def __init__(self, message, content, code):
111111

112112

113113
class GithubRequest(object):
114+
115+
"""Make an API request.
116+
117+
:see: :class:`github2.client.Github`
118+
119+
"""
120+
114121
url_format = "%(github_url)s/api/%(api_version)s/%(api_format)s"
115122
api_version = "v2"
116123
api_format = "json"
@@ -120,10 +127,6 @@ def __init__(self, username=None, api_token=None, url_prefix=None,
120127
requests_per_second=None, access_token=None,
121128
cache=None, proxy_host=None, proxy_port=None,
122129
github_url=None):
123-
"""Make an API request.
124-
125-
:see: :class:`github2.client.Github`
126-
"""
127130
self.username = username
128131
self.api_token = api_token
129132
self.access_token = access_token

github2/teams.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@
55

66
class Team(BaseData):
77

8-
""".. versionadded:: 0.4.0"""
8+
"""Team container.
9+
10+
.. versionadded:: 0.4.0
11+
12+
"""
913

1014
id = Attribute("The team id")
1115
name = Attribute("Name of the team")
@@ -17,7 +21,11 @@ def __repr__(self):
1721

1822
class Teams(GithubCommand):
1923

20-
""".. versionadded:: 0.4.0"""
24+
"""GitHub API teams functionality.
25+
26+
.. versionadded:: 0.4.0
27+
28+
"""
2129

2230
domain = "teams"
2331

github2/users.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88

99

1010
class Key(BaseData):
11+
12+
"""SSH key container."""
13+
1114
id = Attribute('The key id')
1215
key = Attribute('The SSH key data')
1316
title = Attribute('The title for the SSH key')
@@ -17,6 +20,9 @@ def __repr__(self):
1720

1821

1922
class User(BaseData):
23+
24+
"""GitHub user container."""
25+
2026
id = Attribute("The user id")
2127
login = Attribute("The login username")
2228
name = Attribute("The users full name")
@@ -53,6 +59,9 @@ def __repr__(self):
5359

5460

5561
class Users(GithubCommand):
62+
63+
"""GitHub API user functionality."""
64+
5665
domain = "user"
5766

5867
def search(self, query):

0 commit comments

Comments
 (0)