Skip to content

Commit 17e7883

Browse files
committed
Reformat almost all docstrings.
Removed list_* methods from a few objects including (most importantly) Repository
1 parent a846e6f commit 17e7883

8 files changed

Lines changed: 152 additions & 636 deletions

File tree

github3/auths.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,12 @@ def update(self, scopes=[], add_scopes=[], rm_scopes=[], note='',
5555
note_url=''):
5656
"""Update this authorization.
5757
58-
:param scopes: (optional), replaces the authorization scopes with these
59-
:type scopes: list
60-
:param add_scopes: (optional), scopes to be added
61-
:type add_scopes: list
62-
:param rm_scopes: (optional), scopes to be removed
63-
:type rm_scopes: list
64-
:param note: (optional), new note about authorization
65-
:type note: str
66-
:param note_url: (optional), new note URL about this authorization
67-
:type note_url: str
58+
:param list scopes: (optional), replaces the authorization scopes with
59+
these
60+
:param list add_scopes: (optional), scopes to be added
61+
:param list rm_scopes: (optional), scopes to be removed
62+
:param str note: (optional), new note about authorization
63+
:param str note_url: (optional), new note URL about this authorization
6864
:returns: bool
6965
"""
7066
success = False

github3/events.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def __repr__(self):
4545

4646
@staticmethod
4747
def list_types():
48-
""""""
48+
"""List available payload types"""
4949
return sorted(_payload_handlers.keys())
5050

5151
def is_public(self):

github3/gists.py

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,7 @@ def _update_(self, data):
110110
def create_comment(self, body):
111111
"""Create a comment on this gist.
112112
113-
:param body: (required), body of the comment
114-
:type body: str
113+
:param str body: (required), body of the comment
115114
:returns: :class:`GistComment <GistComment>`
116115
"""
117116
url = self._build_url('comments', base_url=self._api)
@@ -129,14 +128,12 @@ def delete(self):
129128
def edit(self, description='', files={}):
130129
"""Edit this gist.
131130
132-
:param description: (optional), description of the gist
133-
:type description: str
134-
:param files: (optional), files that make up this gist; the key(s)
135-
should be the file name(s) and the values should be another
131+
:param str description: (optional), description of the gist
132+
:param dict files: (optional), files that make up this gist; the
133+
key(s) should be the file name(s) and the values should be another
136134
(optional) dictionary with (optional) keys: 'content' and
137135
'filename' where the former is the content of the file and the
138136
latter is the new name of the file.
139-
:type files: dict
140137
:returns: bool -- whether the edit was successful
141138
"""
142139
data = {}
@@ -187,29 +184,11 @@ def iter_comments(self, number=-1):
187184
url = self._build_url('comments', base_url=self._api)
188185
return self._iter(int(number), url, GistComment)
189186

190-
def list_comments(self):
191-
"""List comments on this gist.
192-
193-
:returns: list of :class:`GistComment <GistComment>`\ s
194-
"""
195-
url = self._build_url('comments', base_url=self._api)
196-
json = self._json(self._get(url), 200)
197-
return [GistComment(c, self) for c in json]
198-
199-
def list_files(self):
200-
"""List of :class:`GistFile <GistFile>` objects representing the files
201-
stored in this gist."""
202-
return self._files
203-
204187
def iter_files(self):
205188
"""List of :class:`GistFile <GistFile>` objects representing the files
206189
stored in this gist."""
207190
return iter(self._files)
208191

209-
def list_forks(self):
210-
"""List of :class:`Gist <Gist>`\ s representing forks of this gist."""
211-
return self._forks
212-
213192
def iter_forks(self):
214193
"""List of :class:`Gist <Gist>`\ s representing forks of this gist."""
215194
return iter(self._forks)

github3/git.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,8 @@ def delete(self):
123123
def update(self, sha, force=False):
124124
"""Update this reference.
125125
126-
:param sha: (required), sha of the reference
127-
:type sha: str
128-
:param force: (optional), force the update or not
129-
:type force: bool
126+
:param str sha: (required), sha of the reference
127+
:param bool force: (optional), force the update or not
130128
:returns: bool
131129
"""
132130
data = dumps({'sha': sha, 'force': force})

github3/issues.py

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -288,19 +288,14 @@ def edit(self, title=None, body=None, assignee=None, state=None,
288288
milestone=None, labels=None):
289289
"""Edit this issue.
290290
291-
:param title: Title of the issue
292-
:type title: str
293-
:param body: markdown formatted body (description) of the issue
294-
:type body: str
295-
:param assignee: login name of user the issue should be assigned to
296-
:type assignee: str
297-
:param state: accepted values: ('open', 'closed')
298-
:type state: str
299-
:param milestone: the NUMBER (not title) of the milestone to assign
300-
this to [1]_
301-
:type milestone: int
302-
:param labels: list of labels to apply this to
303-
:type labels: list of str's
291+
:param str title: Title of the issue
292+
:param str body: markdown formatted body (description) of the issue
293+
:param str assignee: login name of user the issue should be assigned
294+
to
295+
:param str state: accepted values: ('open', 'closed')
296+
:param int milestone: the NUMBER (not title) of the milestone to
297+
assign this to [1]_
298+
:param list labels: list of labels to apply this to
304299
:returns: bool
305300
306301
.. [1] Milestone numbering starts at 1, i.e. the first milestone you
@@ -388,8 +383,7 @@ def remove_all_labels(self):
388383
def replace_labels(self, labels):
389384
"""Replace all labels on this issue with ``labels``.
390385
391-
:param labels: label names
392-
:type: list of str's
386+
:param list labels: label names
393387
:returns: bool
394388
"""
395389
url = self._build_url('labels', base_url=self._api)

github3/orgs.py

Lines changed: 23 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ def add_member(self, login):
4848
def add_repo(self, repo):
4949
"""Add ``repo`` to this team.
5050
51-
:param repo: (required), form: 'user/repo'
52-
:type repo: str
51+
:param str repo: (required), form: 'user/repo'
5352
:returns: bool
5453
"""
5554
url = self._build_url('repos', repo, base_url=self._api)
@@ -67,10 +66,8 @@ def delete(self):
6766
def edit(self, name, permission=''):
6867
"""Edit this team.
6968
70-
:param name: (required)
71-
:type name: str
72-
:param permission: (optional), ('pull', 'push', 'admin')
73-
:type permission: str
69+
:param str name: (required)
70+
:param str permission: (optional), ('pull', 'push', 'admin')
7471
:returns: bool
7572
"""
7673
if name:
@@ -84,8 +81,7 @@ def edit(self, name, permission=''):
8481
def has_repo(self, repo):
8582
"""Checks if this team has access to ``repo``
8683
87-
:param repo: (required), form: 'user/repo'
88-
:type repo: str
84+
:param str repo: (required), form: 'user/repo'
8985
:returns: bool
9086
"""
9187
url = self._build_url('repos', repo, base_url=self._api)
@@ -94,8 +90,7 @@ def has_repo(self, repo):
9490
def is_member(self, login):
9591
"""Check if ``login`` is a member of this team.
9692
97-
:param login: (required), login name of the user
98-
:type login: str
93+
:param str login: (required), login name of the user
9994
:returns: bool
10095
"""
10196
url = self._build_url('members', login, base_url=self._api)
@@ -145,8 +140,7 @@ def list_repos(self):
145140
def remove_member(self, login):
146141
"""Remove ``login`` from this team.
147142
148-
:param login: (required), login of the member to remove
149-
:type login: str
143+
:param str login: (required), login of the member to remove
150144
:returns: bool
151145
"""
152146
url = self._build_url('members', login, base_url=self._api)
@@ -156,8 +150,7 @@ def remove_member(self, login):
156150
def remove_repo(self, repo):
157151
"""Remove ``repo`` from this team.
158152
159-
:param repo: (required), form: 'user/repo'
160-
:type repo: str
153+
:param str repo: (required), form: 'user/repo'
161154
:returns: bool
162155
"""
163156
url = self._build_url('repos', repo, base_url=self._api)
@@ -190,10 +183,8 @@ def add_member(self, login, team):
190183
Any user that is to be added to an organization, must be added
191184
to a team as per the GitHub api.
192185
193-
:param login: (required), login name of the user to be added
194-
:type login: str
195-
:param team: (required), team name
196-
:type team: str
186+
:param str login: (required), login name of the user to be added
187+
:param str team: (required), team name
197188
:returns: bool
198189
"""
199190
teams = self.list_teams()
@@ -206,8 +197,8 @@ def add_member(self, login, team):
206197
def add_repo(self, repo, team):
207198
"""Add ``repo`` to ``team``.
208199
209-
:param repo: (required), string, form: 'user/repo'
210-
:param team: (required), string
200+
:param str repo: (required), form: 'user/repo'
201+
:param str team: (required)
211202
"""
212203
teams = self.list_teams()
213204
for t in teams:
@@ -275,12 +266,10 @@ def create_team(self, name, repo_names=[], permissions=''):
275266
"""Assuming the authenticated user owns this organization,
276267
create and return a new team.
277268
278-
:param name: (required), name to be given to the team
279-
:type name: str
280-
:param repo_names: (optional) repositories, e.g.
269+
:param str name: (required), name to be given to the team
270+
:param list repo_names: (optional) repositories, e.g.
281271
['github/dotfiles']
282-
:type repo_names: list
283-
:param permissions: (optional), options:
272+
:param str permissions: (optional), options:
284273
285274
- ``pull`` -- (default) members can not push or administer
286275
repositories accessible by this team
@@ -289,7 +278,6 @@ def create_team(self, name, repo_names=[], permissions=''):
289278
- ``admin`` -- members can push, pull and administer
290279
repositories accessible by this team
291280
292-
:type permissions: str
293281
:returns: :class:`Team <Team>`
294282
"""
295283
data = dumps({'name': name, 'repo_names': repo_names,
@@ -307,16 +295,11 @@ def edit(self,
307295
name=None):
308296
"""Edit this organization.
309297
310-
:param billing_email: (optional) Billing email address (private)
311-
:type billing_email: str
312-
:param company: (optional)
313-
:type company: str
314-
:param email: (optional) Public email address
315-
:type email: str
316-
:param location: (optional)
317-
:type location: str
318-
:param name: (optional)
319-
:type name: str
298+
:param str billing_email: (optional) Billing email address (private)
299+
:param str company: (optional)
300+
:param str email: (optional) Public email address
301+
:param str location: (optional)
302+
:param str name: (optional)
320303
:returns: bool
321304
"""
322305
json = None
@@ -420,9 +403,8 @@ def iter_repos(self, type='', number=-1):
420403
def list_repos(self, type=''):
421404
"""List repos for this organization.
422405
423-
:param type: (optional), accepted values:
406+
:param str type: (optional), accepted values:
424407
('all', 'public', 'member', 'private'), API default: 'all'
425-
:type type: str
426408
:returns: list of :class:`Repository <github3.repos.Repository>`
427409
objects
428410
"""
@@ -477,10 +459,8 @@ def remove_member(self, login):
477459
def remove_repo(self, repo, team):
478460
"""Remove ``repo`` from ``team``.
479461
480-
:param repo: (required), form: 'user/repo'
481-
:type repo: str
482-
:param team: (required)
483-
:type team: str
462+
:param str repo: (required), form: 'user/repo'
463+
:param str team: (required)
484464
:returns: bool
485465
"""
486466
teams = self.list_teams()
@@ -494,8 +474,7 @@ def team(self, team_id):
494474
"""Returns Team object with information about team specified by
495475
``team_id``.
496476
497-
:param team_id: (required), unique id for the team
498-
:type team_id: int
477+
:param int team_id: (required), unique id for the team
499478
:returns: :class:`Team <Team>`
500479
"""
501480
json = None

github3/pulls.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,8 @@ def list_files(self):
240240
def merge(self, commit_message=''):
241241
"""Merge this pull request.
242242
243-
:param commit_message: (optional), message to be used for the merge
244-
commit
245-
:type commit_message: str
243+
:param str commit_message: (optional), message to be used for the
244+
merge commit
246245
:returns: bool
247246
"""
248247
data = None
@@ -256,20 +255,17 @@ def merge(self, commit_message=''):
256255
def reopen(self):
257256
"""Re-open a closed Pull Request.
258257
259-
:param: bool
258+
:returns: bool
260259
"""
261260
return self.update(self.title, self.body, 'open')
262261

263262
@requires_auth
264263
def update(self, title=None, body=None, state=None):
265264
"""Update this pull request.
266265
267-
:param title: (optional), title of the pull
268-
:type title: str
269-
:param body: (optional), body of the pull request
270-
:type body: str
271-
:param state: (optional), ('open', 'closed')
272-
:type state: str
266+
:param str title: (optional), title of the pull
267+
:param str body: (optional), body of the pull request
268+
:param str state: (optional), ('open', 'closed')
273269
:returns: bool
274270
"""
275271
data = {'title': title, 'body': body, 'state': state}

0 commit comments

Comments
 (0)