Skip to content

Commit d8f4d6c

Browse files
committed
Merge branch 'feat/pep_257'
* feat/pep_257: Use class docstring with autodoc. Added some more missing docstrings. [QA] Use imperative form as per PEP 257. [QA] Use PEP 257 punctuation guidelines. [QA] Follow PEP 257 whitespace rules.
2 parents 3a82036 + 031018e commit d8f4d6c

14 files changed

Lines changed: 274 additions & 109 deletions

doc/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@
229229
[u'Ask Solem'], 1)
230230
]
231231

232-
autoclass_content = "init"
232+
autoclass_content = "class"
233233
autodoc_default_flags = ['members', ]
234234

235235
intersphinx_mapping = {

github2/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"Github API v2 library for Python"
1+
"GitHub API v2 library for Python."
22

33
from github2 import _version
44

github2/bin/manage_collaborators.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,19 @@
2424

2525

2626
def print_(text):
27-
"""Python 2 & 3 compatible print function
27+
"""Python 2 & 3 compatible print function.
2828
29-
We support <2.6, so can't use __future__.print_function"""
29+
We support <2.6, so can't use __future__.print_function
30+
31+
"""
3032
if PY3K:
3133
print(text)
3234
else:
3335
sys.stdout.write(text + '\n')
3436

3537

3638
def parse_commandline():
37-
"""Parse the comandline and return parsed options."""
39+
"""Parse the command line and return parsed options."""
3840

3941
parser = OptionParser()
4042
parser.description = __doc__
@@ -73,7 +75,7 @@ def parse_commandline():
7375

7476

7577
def main():
76-
"""This implements the actual program functionality"""
78+
"""Implement the actual program functionality."""
7779

7880
options, args = parse_commandline()
7981

github2/bin/search_repos.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,19 @@
1717

1818

1919
def print_(text):
20-
"""Python 2 & 3 compatible print function
20+
"""Python 2 & 3 compatible print function.
2121
22-
We support <2.6, so can't use __future__.print_function"""
22+
We support <2.6, so can't use __future__.print_function
23+
24+
"""
2325
if PY3K:
2426
print(text)
2527
else:
2628
sys.stdout.write(text + '\n')
2729

2830

2931
def parse_commandline():
30-
"""Parse the comandline and return parsed options."""
32+
"""Parse the command line and return parsed options."""
3133

3234
parser = OptionParser()
3335
parser.description = __doc__
@@ -46,7 +48,7 @@ def parse_commandline():
4648

4749

4850
def main():
49-
"""This implements the actual program functionality"""
51+
"""Implement the actual program functionality."""
5052
return_value = 0
5153

5254
options, term = parse_commandline()

github2/client.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +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-
"""
17-
An interface to GitHub's API:
18-
http://develop.github.com/
18+
"""Setup GitHub API object.
1919
2020
.. versionadded:: 0.2.0
2121
The ``requests_per_second`` parameter
@@ -42,6 +42,7 @@ def __init__(self, username=None, api_token=None, requests_per_second=None,
4242
default to 8080 if a proxy_host is set and no port is set).
4343
:param str github_url: the hostname to connect to, for GitHub
4444
Enterprise support
45+
4546
"""
4647

4748
self.request = GithubRequest(username=username, api_token=api_token,
@@ -59,59 +60,65 @@ def __init__(self, username=None, api_token=None, requests_per_second=None,
5960
self.pull_requests = PullRequests(self.request)
6061

6162
def project_for_user_repo(self, user, repo):
62-
"""Return GitHub identifier for a user's repository
63+
"""Return GitHub identifier for a user's repository.
6364
6465
:param str user: repository owner
6566
:param str repo: repository name
67+
6668
"""
6769
return "/".join([user, repo])
6870

6971
def get_all_blobs(self, project, tree_sha):
70-
"""Get a list of all blobs for a specific tree
72+
"""Get a list of all blobs for a specific tree.
7173
7274
.. versionadded:: 0.3.0
7375
7476
:param str project: GitHub project
7577
:param str tree_sha: object ID of tree
78+
7679
"""
7780
blobs = self.request.get("blob/all", project, tree_sha)
7881
return blobs.get("blobs")
7982

8083
def get_blob_info(self, project, tree_sha, path):
81-
"""Get the blob for a file within a specific tree
84+
"""Get the blob for a file within a specific tree.
8285
8386
:param str project: GitHub project
8487
:param str tree_sha: object ID of tree
8588
:param str path: path within tree to fetch blob for
89+
8690
"""
8791
blob = self.request.get("blob/show", project, tree_sha, path)
8892
return blob.get("blob")
8993

9094
def get_tree(self, project, tree_sha):
91-
"""Get tree information for a specifc tree
95+
"""Get tree information for a specifc tree.
9296
9397
:param str project: GitHub project
9498
:param str tree_sha: object ID of tree
99+
95100
"""
96101
tree = self.request.get("tree/show", project, tree_sha)
97102
return tree.get("tree", [])
98103

99104
def get_network_meta(self, project):
100-
"""Get GitHub metadata associated with a project
105+
"""Get GitHub metadata associated with a project.
101106
102107
:param str project: GitHub project
108+
103109
"""
104110
return self.request.raw_request("/".join([self.request.github_url,
105111
project,
106112
"network_meta"]), {})
107113

108114
def get_network_data(self, project, nethash, start=None, end=None):
109-
"""Get chunk of GitHub network data
115+
"""Get chunk of GitHub network data.
110116
111117
:param str project: GitHub project
112118
:param str nethash: identifier provided by :meth:`get_network_meta`
113119
:param int start: optional start point for data
114120
:param int stop: optional end point for data
121+
115122
"""
116123
data = {"nethash": nethash}
117124
if start:

github2/commits.py

Lines changed: 10 additions & 2 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,10 +28,13 @@ 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):
31-
"""List commits on a project
37+
"""List commits on a project.
3238
3339
.. warning::
3440
Not all projects use ``master`` as their default branch, you can
@@ -39,15 +45,17 @@ def list(self, project, branch="master", file=None, page=1):
3945
:param str branch: branch name, or ``master`` if not given
4046
:param str file: optional file filter
4147
:param int page: optional page number
48+
4249
"""
4350
return self.get_values("list", project, branch, file, filter="commits",
4451
datatype=Commit, page=page)
4552

4653
def show(self, project, sha):
47-
"""Get a specific commit
54+
"""Get a specific commit.
4855
4956
:param str project: project name
5057
:param str sha: commit id
58+
5159
"""
5260
return self.get_value("show", project, sha,
5361
filter="commit", datatype=Commit)

0 commit comments

Comments
 (0)