Skip to content

Commit d0c52ce

Browse files
alexwlchanagjohnson
authored andcommitted
Finish PEP 257 cleanup and enable linting in CI (#2839)
* Fix a few remaining PEP 257 violations * Enable PEP 257 linting in CI
1 parent ef2a698 commit d0c52ce

File tree

5 files changed

+21
-13
lines changed

5 files changed

+21
-13
lines changed

prospector.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ mccabe:
2929
run: false
3030

3131
pep257:
32-
run: false
32+
run: true
3333
disable:
3434
- D105
3535
- D211

readthedocs/bookmarks/views.py

+14-6
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def get(self, request):
3737
def post(self, request, *args, **kwargs):
3838
"""
3939
Returns:
40+
4041
200 response with exists = True in json if bookmark exists.
4142
404 with exists = False in json if no matching bookmark is found.
4243
400 if json data is missing any one of: project, version, page.
@@ -71,7 +72,9 @@ def post(self, request, *args, **kwargs):
7172

7273

7374
class BookmarkListView(ListView):
74-
""" Displays all of a logged-in user's bookmarks """
75+
76+
"""Displays all of a logged-in user's bookmarks"""
77+
7578
model = Bookmark
7679

7780
@method_decorator(login_required)
@@ -83,7 +86,8 @@ def get_queryset(self):
8386

8487

8588
class BookmarkAddView(View):
86-
""" Adds bookmarks in response to POST requests """
89+
90+
"""Adds bookmarks in response to POST requests"""
8791

8892
@method_decorator(login_required)
8993
@method_decorator(csrf_exempt)
@@ -100,8 +104,10 @@ def get(self, request):
100104
)
101105

102106
def post(self, request, *args, **kwargs):
103-
"""Add a new bookmark for the current user to point at
104-
``project``, ``version``, ``page``, and ``url``.
107+
"""
108+
Add a new bookmark for the current user.
109+
110+
Points at ``project``, ``version``, ``page``, and ``url``.
105111
"""
106112
post_json = json.loads(request.body)
107113
try:
@@ -139,6 +145,7 @@ def post(self, request, *args, **kwargs):
139145

140146

141147
class BookmarkRemoveView(View):
148+
142149
"""
143150
Deletes a user's bookmark in response to a POST request.
144151
@@ -158,8 +165,9 @@ def get(self, request, *args, **kwargs):
158165

159166
def post(self, request, *args, **kwargs):
160167
"""
161-
Will delete bookmark with a primary key from the url
162-
or using json data in request.
168+
Delete a bookmark.
169+
170+
Uses the primary key from the URL or JSON data from the request.
163171
"""
164172
if 'bookmark_pk' in kwargs:
165173
bookmark = get_object_or_404(Bookmark, pk=kwargs['bookmark_pk'])

readthedocs/builds/version_slug.py

+2
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ def slugify(self, content):
7373

7474
def uniquifying_suffix(self, iteration):
7575
"""
76+
Create a unique suffix.
77+
7678
This creates a suffix based on the number given as ``iteration``. It
7779
will return a value encoded as lowercase ascii letter. So we have an
7880
alphabet of 26 letters. The returned suffix will be for example ``_yh``

readthedocs/doc_builder/base.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,7 @@ def build(self, id=None, **kwargs):
5151
raise NotImplementedError
5252

5353
def move(self, **kwargs):
54-
"""
55-
Move the documentation from where it was generated to
56-
its artifact directory.
57-
"""
54+
"""Move the generated documentation to its artifact directory."""
5855
if os.path.exists(self.old_artifact_path):
5956
if os.path.exists(self.target):
6057
shutil.rmtree(self.target)

readthedocs/privacy/backend.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,9 @@ class VersionQuerySet(SettingsOverrideObject):
177177
class BuildManager(models.Manager):
178178

179179
"""
180-
Build objects that take into account the privacy of the Version
181-
that they relate to.
180+
Build objects that are privacy aware.
181+
182+
i.e. they take into account the privacy of the Version that they relate to.
182183
"""
183184

184185
use_for_related_fields = True

0 commit comments

Comments
 (0)