diff --git a/readthedocs/builds/admin.py b/readthedocs/builds/admin.py index b11d53034e7..31d5fa3e643 100644 --- a/readthedocs/builds/admin.py +++ b/readthedocs/builds/admin.py @@ -1,6 +1,4 @@ -"""Django admin interface for `~builds.models.Build` and related models. - -""" +"""Django admin interface for `~builds.models.Build` and related models.""" from django.contrib import admin from readthedocs.builds.models import Build, VersionAlias, Version, BuildCommandResult diff --git a/readthedocs/builds/models.py b/readthedocs/builds/models.py index 22d6083c798..0a64af19731 100644 --- a/readthedocs/builds/models.py +++ b/readthedocs/builds/models.py @@ -96,7 +96,6 @@ def commit_name(self): The result could be used as ref in a git repo, e.g. for linking to GitHub or Bitbucket. """ - # LATEST is special as it is usually a branch but does not contain the # name in verbose_name. if self.slug == LATEST: @@ -141,9 +140,7 @@ def get_absolute_url(self): return self.project.get_docs_url(version_slug=self.slug, private=private) def save(self, *args, **kwargs): - """ - Add permissions to the Version for all owners on save. - """ + """Add permissions to the Version for all owners on save.""" from readthedocs.projects import tasks obj = super(Version, self).save(*args, **kwargs) for owner in self.project.users.all(): @@ -164,7 +161,7 @@ def delete(self, *args, **kwargs): @property def identifier_friendly(self): - '''Return display friendly identifier''' + """Return display friendly identifier""" if re.match(r'^[0-9a-f]{40}$', self.identifier, re.I): return self.identifier[:8] return self.identifier @@ -201,18 +198,18 @@ def get_conf_py_path(self): return conf_py_path def get_build_path(self): - '''Return version build path if path exists, otherwise `None`''' + """Return version build path if path exists, otherwise `None`""" path = self.project.checkout_path(version=self.slug) if os.path.exists(path): return path return None def clean_build_path(self): - '''Clean build path for project version + """Clean build path for project version Ensure build path is clean for project version. Used to ensure stale build checkouts for each project version are removed. - ''' + """ try: path = self.get_build_path() if path is not None: @@ -349,28 +346,29 @@ def get_absolute_url(self): @property def finished(self): - '''Return if build has a finished state''' + """Return if build has a finished state""" return self.state == BUILD_STATE_FINISHED class BuildCommandResultMixin(object): - '''Mixin for common command result methods/properties + """Mixin for common command result methods/properties Shared methods between the database model :py:class:`BuildCommandResult` and non-model respresentations of build command results from the API - ''' + """ @property def successful(self): - '''Did the command exit with a successful exit code''' + """Did the command exit with a successful exit code""" return self.exit_code == 0 @property def failed(self): - '''Did the command exit with a failing exit code + """Did the command exit with a failing exit code - Helper for inverse of :py:meth:`successful`''' + Helper for inverse of :py:meth:`successful` + """ return not self.successful diff --git a/readthedocs/builds/version_slug.py b/readthedocs/builds/version_slug.py index ac801174df0..a96b66254e3 100644 --- a/readthedocs/builds/version_slug.py +++ b/readthedocs/builds/version_slug.py @@ -34,9 +34,8 @@ class VersionSlugField(models.CharField): - """ - Implementation inspired by ``django_extensions.db.fields.AutoSlugField``. - """ + + """Inspired by ``django_extensions.db.fields.AutoSlugField``.""" invalid_chars_re = re.compile('[^-._a-z0-9]') leading_punctuation_re = re.compile('^[-._]+')