Skip to content

Commit 06bb27d

Browse files
committed
More documentation for Issues class' methods.
1 parent e9c0e9a commit 06bb27d

File tree

1 file changed

+62
-19
lines changed

1 file changed

+62
-19
lines changed

github2/issues.py

Lines changed: 62 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -40,84 +40,127 @@ class Issues(GithubCommand):
4040
def search(self, project, term, state="open"):
4141
"""Get all issues for project that match term with given state.
4242
43-
``project`` is a string with the project owner username and repository
44-
name separated by ``/`` (e.g. ``ask/pygithub2``).
45-
``term`` is a string to search issues for.
46-
``state`` can be either ``open`` or ``closed``.
43+
:param str project: GitHub project
44+
:param str term: term to search issues for
45+
:param str state: can be either ``open`` or ``closed``.
4746
"""
4847
return self.get_values("search", project, state,
4948
urllib.quote_plus(term), filter="issues",
5049
datatype=Issue)
5150

5251
def list(self, project, state="open"):
53-
"""Get all issues for project' with state'.
52+
"""Get all issues for project with given state.
5453
55-
``project`` is a string with the project owner username and repository
56-
name separated by ``/`` (e.g. ``ask/pygithub2``).
57-
``state`` can be either ``open`` or ``closed``.
54+
:param str project: GitHub project
55+
:param str state: can be either ``open`` or ``closed``.
5856
"""
5957
return self.get_values("list", project, state, filter="issues",
6058
datatype=Issue)
6159

6260
def list_by_label(self, project, label):
63-
"""Get all issues for project' with label'.
61+
"""Get all issues for project with label.
6462
65-
``project`` is a string with the project owner username and repository
66-
name separated by ``/`` (e.g. ``ask/pygithub2``).
67-
``label`` is a string representing a label (e.g., ``bug``).
63+
:param str project: GitHub project
64+
:param str label: a string representing a label (e.g., ``bug``).
6865
"""
6966
return self.get_values("list", project, "label", label, filter="issues",
7067
datatype=Issue)
7168

7269
def list_labels(self, project):
73-
"""Get all labels for project'.
70+
"""Get all labels for project.
7471
75-
``project`` is a string with the project owner username and repository
76-
name separated by ``/`` (e.g. ``ask/pygithub2``).
72+
:param str project: GitHub project
7773
"""
7874
return self.get_values("labels", project, filter="labels")
7975

8076
def show(self, project, number):
81-
"""Get all the data for issue by issue-number."""
77+
"""Get all the data for issue by issue-number.
78+
79+
:param str project: GitHub project
80+
:param int number: issue number in the Github database
81+
"""
8282
return self.get_value("show", project, str(number),
8383
filter="issue", datatype=Issue)
8484

8585
def open(self, project, title, body):
86-
"""Open up a new issue."""
86+
"""Open up a new issue.
87+
88+
:param str project: GitHub project
89+
:param str title: title for issue
90+
:param str body: body for issue
91+
"""
8792
issue_data = {"title": title, "body": body}
8893
return self.get_value("open", project, post_data=issue_data,
8994
filter="issue", datatype=Issue)
9095

9196
def close(self, project, number):
97+
"""Close an issue
98+
99+
:param str project: GitHub project
100+
:param int number: issue number in the Github database
101+
"""
92102
return self.get_value("close", project, str(number), filter="issue",
93103
datatype=Issue, method="POST")
94104

95105
def reopen(self, project, number):
106+
"""Reopen a closed issue
107+
108+
:param str project: GitHub project
109+
:param int number: issue number in the Github database
110+
"""
96111
return self.get_value("reopen", project, str(number), filter="issue",
97112
datatype=Issue, method="POST")
98113

99114
def edit(self, project, number, title, body):
115+
"""Edit an existing issue
116+
117+
:param str project: GitHub project
118+
:param int number: issue number in the Github database
119+
:param str title: title for issue
120+
:param str body: body for issue
121+
"""
100122
issue_data = {"title": title, "body": body}
101123
return self.get_value("edit", project, str(number),
102124
post_data=issue_data, filter="issue",
103125
datatype=Issue)
104126

105127
def add_label(self, project, number, label):
128+
"""Add a label to an issue
129+
130+
:param str project: GitHub project
131+
:param int number: issue number in the Github database
132+
:param str label: label to attach to issue
133+
"""
106134
return self.make_request("label/add", project, label, str(number),
107135
filter="labels", method="POST")
108136

109137
def remove_label(self, project, number, label):
138+
"""Remove an existing label from an issue
139+
140+
:param str project: GitHub project
141+
:param int number: issue number in the Github database
142+
:param str label: label to remove from issue
143+
"""
110144
return self.make_request("label/remove", project, label, str(number),
111145
filter="labels", method="POST")
112146

113147
def comment(self, project, number, comment):
114-
"""Comment on an issue."""
148+
"""Comment on an issue.
149+
150+
:param str project: GitHub project
151+
:param int number: issue number in the Github database
152+
:param str comment: comment to attach to issue
153+
"""
115154
comment_data = {'comment': comment}
116155
return self.make_request("comment", project, str(number),
117156
post_data=comment_data,
118157
filter='comment')
119158

120159
def comments(self, project, number):
121-
"""View comments on an issue."""
160+
"""View comments on an issue.
161+
162+
:param str project: GitHub project
163+
:param int number: issue number in the Github database
164+
"""
122165
return self.get_values("comments", project, str(number),
123166
filter="comments", datatype=Comment)

0 commit comments

Comments
 (0)