8000 PEP257 for github3.gists · Web5design/github3.py@a6ff9e9 · GitHub
[go: up one dir, main page]

Skip to content

Commit a6ff9e9

Browse files
committed
PEP257 for github3.gists
1 parent f8fc9f4 commit a6ff9e9

File tree

4 files changed

+74
-20
lines changed

4 files changed

+74
-20
lines changed

github3/gists/comment.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
1+
"""
2+
github3.gists.comment
3+
---------------------
4+
5+
Module containing the logic for a GistComment
6+
7+
"""
8+
19
from github3.models import BaseComment
210
from github3.users import User
311

412

513
class GistComment(BaseComment):
6-
"""The :class:`GistComment <GistComment>` object. This represents a comment
7-
on a gist.
14+
15+
"""This object represents a comment on a gist.
816
917
Two comment instances can be checked like so::
1018
@@ -17,11 +25,14 @@ class GistComment(BaseComment):
1725
c1.id != c2.id
1826
1927
See also: http://developer.github.com/v3/gists/comments/
28+
2029
"""
30+
2131
def __init__(self, comment, session=None):
2232
super(GistComment, self).__init__(comment, session)
2333

2434
#: :class:`User <github3.users.User>` who made the comment
35+
#: Unless it is not associated with an account
2536
self.user = None
2637
if comment.get('user'):
2738
self.user = User(comment.get('user'), self) # (No coverage)

github3/gists/file.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,22 @@
1+
"""
2+
github3.gists.file
3+
------------------
4+
5+
Module containing the logic for the GistFile object.
6+
"""
7+
18
from github3.models import GitHubObject
29

310

411
class GistFile(GitHubObject):
5-
"""The :class:`GistFile <GistFile>` object. This is used to represent a
6-
file object returned by GitHub while interacting with gists.
12+
13+
"""This represents the file object returned by interacting with gists.
14+
15+
It stores the raw url of the file, the file name, language, size and
16+
content.
17+
718
"""
19+
820
def __init__(self, attributes):
921
super(GistFile, self).__init__(attributes)
1022

github3/gists/gist.py

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@
1515

1616

1717
class Gist(GitHubCore):
18-
"""The :class:`Gist <Gist>` object. This object holds all the information
19-
returned by Github about a gist. With it you can comment on or fork the
20-
gist (assuming you are authenticated), edit or delete the gist (assuming
21-
you own it). You can also "star" or "unstar" the gist (again assuming you
22-
have authenticated).
18+
19+
"""This object holds all the information returned by Github about a gist.
20+
21+
With it you can comment on or fork the gist (assuming you are
22+
authenticated), edit or delete the gist (assuming you own it). You can
23+
also "star" or "unstar" the gist (again assuming you have authenticated).
2324
2425
Two gist instances can be checked like so::
2526
@@ -32,7 +33,9 @@ class Gist(GitHubCore):
3233
g1.id != g2.id
3334
3435
See also: http://developer.github.com/v3/gists/
36+
3537
"""
38+
3639
def __init__(self, data, session=None):
3740
super(Gist, self).__init__(data, session)
3841
#: Number of comments on this gist
@@ -102,6 +105,7 @@ def create_comment(self, body):
102105
103106
:param str body: (required), body of the comment
104107
:returns: :class:`GistComment <github3.gists.comment.GistComment>`
108+
105109
"""
106110
json = None
107111
if body:
@@ -113,7 +117,9 @@ def create_comment(self, body):
113117
def delete(self):
114118
"""Delete this gist.
115119
116-
:returns: bool -- whether the deletion was successful"""
120+
:returns: bool -- whether the deletion was successful
121+
122+
"""
117123
return self._boolean(self._delete(self._api), 204, 404)
118124

119125
@requires_auth
@@ -127,6 +133,7 @@ def edit(self, description='', files={}):
127133
'filename' where the former is the content of the file and the
128134
latter is the new name of the file.
129135
:returns: bool -- whether the edit was successful
136+
130137
"""
131138
data = {}
132139
json = None
@@ -146,23 +153,26 @@ def fork(self):
146153
"""Fork this gist.
147154
148155
:returns: :class:`Gist <Gist>` if successful, ``None`` otherwise
156+
149157
"""
150158
url = self._build_url('forks', base_url=self._api)
151159
json = self._json(self._post(url), 201)
152160
return Gist(json, self) if json else None
153161

154162
def is_public(self):
155-
"""Checks to see if this gist is public or not.
163+
"""Check to see if this gist is public or not.
156164
157165
:returns: bool -- True if public, False if private
166+
158167
"""
159168
return self.public
160169

161170
@requires_auth
162171
def is_starred(self):
163-
"""Checks to see if this gist is starred by the authenticated user.
172+
"""Check to see if this gist is starred by the authenticated user.
164173
165174
:returns: bool -- True if it is starred, False otherwise
175+
166176
"""
167177
url = self._build_url('star', base_url=self._api)
168178
return self._boolean(self._get(url), 204, 404)
@@ -175,7 +185,8 @@ def iter_comments(self, number=-1, etag=None):
175185
:param str etag: (optional), ETag from a previous request to the same
176186
endpoint
177187
:returns: generator of
178-
:class:`GistComment <github3.gists.comment.GistComment>`\ s
188+
:class:`GistComment <github3.gists.comment.GistComment>`
189+
179190
"""
180191
url = self._build_url('comments', base_url=self._api)
181192
return self._iter(int(number), url, GistComment, etag=etag)
@@ -192,25 +203,34 @@ def iter_commits(self, number=-1):
192203
Default: -1 will iterate over all commits associated with this
193204
gist.
194205
:returns: generator of
195-
:class: `GistHistory <github3.gists.history.GistHistory>`\ s
206+
:class:`GistHistory <github3.gists.history.GistHistory>`
207+
196208
"""
197209
url = self._build_url('commits', base_url=self._api)
198210
return self._iter(int(number), url, GistHistory)
199211

200212
def iter_files(self):
201-
"""List of :class:`GistFile <GistFile>` objects representing the files
202-
stored in this gist."""
213+
"""Iterator over the files stored in this gist.
214+
215+
:returns: generator of :class`GistFile <github3.gists.file.GistFile>`
216+
217+
"""
203218
return iter(self._files)
204219

205220
def iter_forks(self):
206-
"""List of :class:`Gist <Gist>`\ s representing forks of this gist."""
221+
"""Iterator of forks of this gist.
222+
223+
:returns: generator of :class:`Gist <Gist>`
224+
225+
"""
207226
return iter(self._forks) # (No coverage)
208227

209228
@requires_auth
210229
def star(self):
211230
"""Star this gist.
212231
213232
:returns: bool -- True if successful, False otherwise
233+
214234
"""
215235
url = self._build_url('star', base_url=self._api)
216236
return self._boolean(self._put(url), 204, 404)
@@ -220,6 +240,7 @@ def unstar(self):
220240
"""Un-star this gist.
221241
222242
:returns: bool -- True if successful, False otherwise
243+
223244
"""
224245
url = self._build_url('star', base_url=self._api)
225246
return self._boolean(self._delete(url), 204, 404)

github3/gists/history.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
1+
"""
2+
github3.gists.history
3+
---------------------
4+
5+
Module containing the logic for the GistHistory object.
6+
7+
"""
8+
19
from github3.models import GitHubCore
210
from github3.users import User
311

412

513
class GistHistory(GitHubCore):
6-
"""The :class:`GistHistory <GistHistory>` object represents one version
7-
(or revision) of a gist.
14+
15+
"""Thisobject represents one version (or revision) of a gist.
816
917
Two history instances can be checked like so::
1018
@@ -17,6 +25,7 @@ class GistHistory(GitHubCore):
1725
h1.version != h2.version
1826
1927
"""
28+
2029
def __init__(self, history, session=None):
2130
super(GistHistory, self).__init__(history, session)
2231
self._api = history.get('url', '')
@@ -53,9 +62,10 @@ def __ne__(self, other):
5362
return self.version != other.version
5463

5564
def get_gist(self):
56-
"""Retrieves the gist at this version.
65+
"""Retrieve the gist at this version.
5766
5867
:returns: :class:`Gist <github3.gists.gist.Gist>`
68+
5969
"""
6070
from github3.gists.gist import Gist
6171
json = self._json(self._get(self._api), 200)

0 commit comments

Comments
 (0)
0