Skip to content

Commit ed5364a

Browse files
alexwlchanagjohnson
authored andcommitted
Docstring/PEP 257 fixes for the builds app (#2831)
1 parent 587f5ee commit ed5364a

File tree

3 files changed

+15
-20
lines changed

3 files changed

+15
-20
lines changed

readthedocs/builds/admin.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
"""Django admin interface for `~builds.models.Build` and related models.
2-
3-
"""
1+
"""Django admin interface for `~builds.models.Build` and related models."""
42

53
from django.contrib import admin
64
from readthedocs.builds.models import Build, VersionAlias, Version, BuildCommandResult

readthedocs/builds/models.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ def commit_name(self):
9696
The result could be used as ref in a git repo, e.g. for linking to
9797
GitHub or Bitbucket.
9898
"""
99-
10099
# LATEST is special as it is usually a branch but does not contain the
101100
# name in verbose_name.
102101
if self.slug == LATEST:
@@ -141,9 +140,7 @@ def get_absolute_url(self):
141140
return self.project.get_docs_url(version_slug=self.slug, private=private)
142141

143142
def save(self, *args, **kwargs):
144-
"""
145-
Add permissions to the Version for all owners on save.
146-
"""
143+
"""Add permissions to the Version for all owners on save."""
147144
from readthedocs.projects import tasks
148145
obj = super(Version, self).save(*args, **kwargs)
149146
for owner in self.project.users.all():
@@ -164,7 +161,7 @@ def delete(self, *args, **kwargs):
164161

165162
@property
166163
def identifier_friendly(self):
167-
'''Return display friendly identifier'''
164+
"""Return display friendly identifier"""
168165
if re.match(r'^[0-9a-f]{40}$', self.identifier, re.I):
169166
return self.identifier[:8]
170167
return self.identifier
@@ -201,18 +198,18 @@ def get_conf_py_path(self):
201198
return conf_py_path
202199

203200
def get_build_path(self):
204-
'''Return version build path if path exists, otherwise `None`'''
201+
"""Return version build path if path exists, otherwise `None`"""
205202
path = self.project.checkout_path(version=self.slug)
206203
if os.path.exists(path):
207204
return path
208205
return None
209206

210207
def clean_build_path(self):
211-
'''Clean build path for project version
208+
"""Clean build path for project version
212209
213210
Ensure build path is clean for project version. Used to ensure stale
214211
build checkouts for each project version are removed.
215-
'''
212+
"""
216213
try:
217214
path = self.get_build_path()
218215
if path is not None:
@@ -349,28 +346,29 @@ def get_absolute_url(self):
349346

350347
@property
351348
def finished(self):
352-
'''Return if build has a finished state'''
349+
"""Return if build has a finished state"""
353350
return self.state == BUILD_STATE_FINISHED
354351

355352

356353
class BuildCommandResultMixin(object):
357354

358-
'''Mixin for common command result methods/properties
355+
"""Mixin for common command result methods/properties
359356
360357
Shared methods between the database model :py:class:`BuildCommandResult` and
361358
non-model respresentations of build command results from the API
362-
'''
359+
"""
363360

364361
@property
365362
def successful(self):
366-
'''Did the command exit with a successful exit code'''
363+
"""Did the command exit with a successful exit code"""
367364
return self.exit_code == 0
368365

369366
@property
370367
def failed(self):
371-
'''Did the command exit with a failing exit code
368+
"""Did the command exit with a failing exit code
372369
373-
Helper for inverse of :py:meth:`successful`'''
370+
Helper for inverse of :py:meth:`successful`
371+
"""
374372
return not self.successful
375373

376374

readthedocs/builds/version_slug.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,8 @@
3434

3535

3636
class VersionSlugField(models.CharField):
37-
"""
38-
Implementation inspired by ``django_extensions.db.fields.AutoSlugField``.
39-
"""
37+
38+
"""Inspired by ``django_extensions.db.fields.AutoSlugField``."""
4039

4140
invalid_chars_re = re.compile('[^-._a-z0-9]')
4241
leading_punctuation_re = re.compile('^[-._]+')

0 commit comments

Comments
 (0)