8000 Clean up docstrings in github3.users · pythonthings/github3.py@b85314c · GitHub
[go: up one dir, main page]

Skip to content

Commit b85314c

Browse files
committed
Clean up docstrings in github3.users
1 parent 3e251f2 commit b85314c

File tree

2 files changed

+51
-44
lines changed

2 files changed

+51
-44
lines changed

github3/users.py

Lines changed: 48 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
"""
3-
github3.users
4-
=============
5-
6-
This module contains everything relating to Users.
7-
8-
"""
2+
"""This module contains everything relating to Users."""
93
from __future__ import unicode_literals
104

115
from json import dumps
@@ -19,18 +13,12 @@
1913

2014

2115
class Key(GitHubCore):
22-
"""The :class:`Key <Key>` object. Please see GitHub's `Key Documentation
23-
<http://developer.github.com/v3/users/keys/>`_ for more information.
24-
25-
Two key instances can be checked like so::
16+
"""The :class:`Key <Key>` object.
2617
27-
k1 == k2
28-
k1 != k2
29-
30-
And is equivalent to::
18+
Please see GitHub's `Key Documentation`_ for more information.
3119
32-
k1.id == k2.id
33-
k1.id != k2.id
20+
.. _Key Documentation:
21+
http://developer.github.com/v3/users/keys/
3422
"""
3523

3624
def _update_attributes(self, key, session=None):
@@ -53,7 +41,7 @@ def __str__(self):
5341

5442
@requires_auth
5543
def delete(self):
56-
"""Delete this Key"""
44+
"""Delete this key."""
5745
return self._boolean(self._delete(self._api), 204, 404)
5846

5947
@requires_auth
@@ -80,10 +68,12 @@ def update(self, title, key):
8068

8169

8270
class Plan(GitHubCore):
83-
"""The :class:`Plan <Plan>` object. This makes interacting with the plan
84-
information about a user easier. Please see GitHub's `Authenticated User
85-
<http://developer.github.com/v3/users/#get-the-authenticated-user>`_
86-
documentation for more specifics.
71+
"""The :class:`Plan <Plan>` object.
72+
73+
Please see GitHub's `Authenticated User`_ documentation for more details.
74+
75+
.. _Authenticated User:
76+
http://developer.github.com/v3/users/#get-the-authenticated-user
8777
"""
8878

8979
def _update_attributes(self, plan):
@@ -106,19 +96,20 @@ def __str__(self):
10696
return self.name
10797

10898
def is_free(self):
109-
"""Checks if this is a free plan.
99+
"""Check if this is a free plan.
110100
111101
:returns: bool
112102
"""
113103
return self.name == 'free' # (No coverage)
114104

115105

116106
class Email(GitHubCore):
117-
118107
"""The :class:`Email` object.
119108
120-
Please see GitHub's `Emails documentation
121-
<https://developer.github.com/v3/users/emails/>` for more information.
109+
Please see GitHub's `Emails documentation`_ for more information.
110+
111+
.. _Emails documentation:
112+
https://developer.github.com/v3/users/emails/
122113
"""
123114

124115
def _update_attributes(self, email):
@@ -139,8 +130,9 @@ def __str__(self):
139130

140131

141132
class User(BaseAccount):
142-
"""The :class:`User <User>` object. This handles and structures information
143-
in the `User section <http://developer.github.com/v3/users/>`_.
133+
"""The :class:`User <User>` object.
134+
135+
This handles and structures information in the `User section`_.
144136
145137
Two user instances can be checked like so::
146138
@@ -152,6 +144,8 @@ class User(BaseAccount):
152144
u1.id == u2.id
153145
u1.id != u2.id
154146
147+
.. _User section:
148+
http://developer.github.com/v3/users/
155149
"""
156150

157151
def _update_attributes(self, user):
@@ -249,7 +243,7 @@ def is_assignee_on(self, username, repository):
249243
return self._boolean(self._get(url), 204, 404)
250244

251245
def is_following(self, username):
252-
"""Checks if this user is following ``username``.
246+
"""Check if this user is following ``username``.
253247
254248
:param str username: (required)
255249
:returns: bool
@@ -259,7 +253,7 @@ def is_following(self, username):
259253
return self._boolean(self._get(url), 204, 404)
260254

261255
def events(self, public=False, number=-1, etag=None):
262-
"""Iterate over events performed by this user.
256+
r"""Iterate over events performed by this user.
263257
264258
:param bool public: (optional), only list public events for the
265259
authenticated user
@@ -276,7 +270,7 @@ def events(self, public=False, number=-1, etag=None):
276270
return self._iter(int(number), url, Event, etag=etag)
277271

278272
def followers(self, number=-1, etag=None):
279-
"""Iterate over the followers of this user.
273+
r"""Iterate over the followers of this user.
280274
281275
:param int number: (optional), number of followers to return. Default:
282276
-1 returns all available
@@ -288,7 +282,7 @@ def followers(self, number=-1, etag=None):
288282
return self._iter(int(number), url, User, etag=etag)
289283

290284
def following(self, number=-1, etag=None):
291-
"""Iterate over the users being followed by this user.
285+
r"""Iterate over the users being followed by this user.
292286
293287
:param int number: (optional), number of users to return. Default: -1
294288
returns all available users
@@ -300,7 +294,7 @@ def following(self, number=-1, etag=None):
300294
return self._iter(int(number), url, User, etag=etag)
301295

302296
def keys(self, number=-1, etag=None):
303-
"""Iterate over the public keys of this user.
297+
r"""Iterate over the public keys of this user.
304298
305299
.. versionadded:: 0.5
306300
@@ -315,8 +309,9 @@ def keys(self, number=-1, etag=None):
315309

316310
@requires_auth
317311
def organization_events(self, org, number=-1, etag=None):
318-
"""Iterate over events as they appear on the user's organization
319-
dashboard. You must be authenticated to view this.
312+
r"""Iterate over events from the user's organization dashboard.
313+
314+
.. note:: You must be authenticated to view this.
320315
321316
:param str org: (required), name of the organization
322317
:param int number: (optional), number of events to return. Default: -1
@@ -331,9 +326,10 @@ def organization_events(self, org, number=-1, etag=None):
331326
return self._iter(int(number), url, Event, etag=etag)
332327

333328
def received_events(self, public=False, number=-1, etag=None):
334-
"""Iterate over events that the user has received. If the user is the
335-
authenticated user, you will see private and public events, otherwise
336-
you will only see public events.
329+
r"""Iterate over events that the user has received.
330+
331+
If the user is the authenticated user, you will see private and public
332+
events, otherwise you will only see public events.
337333
338334
:param bool public: (optional), determines if the authenticated user
339335
sees both private and public or just public
@@ -350,7 +346,7 @@ def received_events(self, public=False, number=-1, etag=None):
350346
return self._iter(int(number), url, Event, etag=etag)
351347

352348
def organizations(self, number=-1, etag=None):
353-
"""Iterate over organizations the user is member of
349+
r"""Iterate over organizations the user is member of.
354350
355351
:param int number: (optional), number of organizations to return.
356352
Default: -1 returns all available organization
@@ -404,8 +400,12 @@ def subscriptions(self, number=-1, etag=None):
404400

405401
@requires_auth
406402
def rename(self, login):
407-
"""Rename the user. This is only available for administrators of
408-
a GitHub Enterprise instance.
403+
"""Rename the user.
404+
405+
.. note::
406+
407+
This is only available for administrators of a GitHub Enterprise
408+
instance.
409409
410410
:param str login: (required), new name of the user
411411
:returns: bool
@@ -506,10 +506,14 @@ def unsuspend(self):
506506

507507
@requires_auth
508508
def delete(self):
509-
"""Delete the user. Per GitHub API documentation, it is often preferable
510-
to suspend the user.
509+
"""Delete the user.
511510
512-
This is only available for admins of a GitHub Enterprise instance.
511+
Per GitHub API documentation, it is often preferable to suspend the
512+
user.
513+
514+
.. note::
515+
516+
This is only available for admins of a GitHub Enterprise instance.
513517
514518
:returns: bool -- True if successful, False otherwise
515519
"""

tox.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,6 @@ commands =
6262
[pytest]
6363
addopts = -q
6464
norecursedirs = *.egg .git .* _*
65+
66+
[flake8]
67+
ignore = D105

0 commit comments

Comments
 (0)
0