Skip to content

Commit

Permalink
Merge pull request #5241 from rtfd/humitos/remove-py2-compatibility
Browse files Browse the repository at this point in the history
Remove py2 compatibility
  • Loading branch information
humitos committed Feb 7, 2019
2 parents a083eca + 9e697d3 commit 70d4cc2
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 27 deletions.
6 changes: 2 additions & 4 deletions readthedocs/builds/models.py
Expand Up @@ -11,7 +11,6 @@
from django.db import models
from django.urls import reverse
from django.utils import timezone
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext
from django.utils.translation import ugettext_lazy as _
from guardian.shortcuts import assign
Expand Down Expand Up @@ -58,7 +57,6 @@
log = logging.getLogger(__name__)


@python_2_unicode_compatible
class Version(models.Model):

"""Version of a ``Project``."""
Expand Down Expand Up @@ -475,7 +473,6 @@ def save(self, *args, **kwargs):
return 0


@python_2_unicode_compatible
class Build(models.Model):

"""Build data."""
Expand Down Expand Up @@ -602,10 +599,12 @@ def save(self, *args, **kwargs): # noqa
"""
if self.pk is None or self._config_changed:
previous = self.previous
# yapf: disable
if (
previous is not None and self._config and
self._config == previous.config
):
# yapf: enable
previous_pk = previous._config.get(self.CONFIG_KEY, previous.pk)
self._config = {self.CONFIG_KEY: previous_pk}
super().save(*args, **kwargs)
Expand Down Expand Up @@ -655,7 +654,6 @@ def failed(self):
return not self.successful


@python_2_unicode_compatible
class BuildCommandResult(BuildCommandResultMixin, models.Model):

"""Build command for a ``Build``."""
Expand Down
2 changes: 0 additions & 2 deletions readthedocs/core/models.py
Expand Up @@ -6,7 +6,6 @@
from annoying.fields import AutoOneToOneField
from django.db import models
from django.urls import reverse
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext
from django.utils.translation import ugettext_lazy as _

Expand All @@ -16,7 +15,6 @@
log = logging.getLogger(__name__)


@python_2_unicode_compatible
class UserProfile(models.Model):

"""Additional information about a User."""
Expand Down
2 changes: 0 additions & 2 deletions readthedocs/gold/models.py
Expand Up @@ -4,7 +4,6 @@
import math

from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _

from readthedocs.projects.models import Project
Expand All @@ -24,7 +23,6 @@
DOLLARS_PER_PROJECT = 5


@python_2_unicode_compatible
class GoldUser(models.Model):

"""A user subscription for gold membership."""
Expand Down
3 changes: 0 additions & 3 deletions readthedocs/integrations/models.py
Expand Up @@ -12,7 +12,6 @@
)
from django.contrib.contenttypes.models import ContentType
from django.db import models, transaction
from django.utils.encoding import python_2_unicode_compatible
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
from jsonfield import JSONField
Expand Down Expand Up @@ -112,7 +111,6 @@ def delete_limit(self, related_object, limit=10):
exchange.delete()


@python_2_unicode_compatible
class HttpExchange(models.Model):

"""HTTP request/response exchange."""
Expand Down Expand Up @@ -230,7 +228,6 @@ def create(self, **kwargs):
return obj


@python_2_unicode_compatible
class Integration(models.Model):

"""Inbound webhook integration for projects."""
Expand Down
3 changes: 0 additions & 3 deletions readthedocs/oauth/models.py
Expand Up @@ -10,7 +10,6 @@
from django.db import models
from django.db.models import Q
from django.urls import reverse
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _

from readthedocs.projects.constants import REPO_CHOICES
Expand All @@ -19,7 +18,6 @@
from .querysets import RemoteOrganizationQuerySet, RemoteRepositoryQuerySet


@python_2_unicode_compatible
class RemoteOrganization(models.Model):

"""
Expand Down Expand Up @@ -74,7 +72,6 @@ def get_serialized(self, key=None, default=None):
pass


@python_2_unicode_compatible
class RemoteRepository(models.Model):

"""
Expand Down
17 changes: 6 additions & 11 deletions readthedocs/projects/models.py
Expand Up @@ -4,15 +4,14 @@

import fnmatch
import logging
import re
import os
import re
from urllib.parse import urlparse

from django.conf import settings
from django.contrib.auth.models import User
from django.db import models
from django.urls import NoReverseMatch, reverse
from django.utils.encoding import python_2_unicode_compatible
from django.utils.functional import cached_property
from django.utils.translation import ugettext_lazy as _
from django_extensions.db.models import TimeStampedModel
Expand Down Expand Up @@ -47,7 +46,6 @@
log = logging.getLogger(__name__)


@python_2_unicode_compatible
class ProjectRelationship(models.Model):

"""
Expand Down Expand Up @@ -89,7 +87,6 @@ def get_absolute_url(self):
return resolve(self.child)


@python_2_unicode_compatible
class Project(models.Model):

"""Project model."""
Expand Down Expand Up @@ -1070,7 +1067,6 @@ def environment_variables(self):
return self._environment_variables


@python_2_unicode_compatible
class ImportedFile(models.Model):

"""
Expand Down Expand Up @@ -1127,7 +1123,11 @@ def json_file_path(self):
basename = os.path.splitext(self.path)[0]
if self.project.documentation_type == 'sphinx_htmldir' and basename.endswith('/index'):
new_basename = re.sub(r'\/index$', '', basename)
log.info('Adjusted json file path: %s -> %s', basename, new_basename)
log.info(
'Adjusted json file path: %s -> %s',
basename,
new_basename,
)
basename = new_basename

file_path = basename + '.fjson'
Expand Down Expand Up @@ -1169,15 +1169,13 @@ class Meta:
abstract = True


@python_2_unicode_compatible
class EmailHook(Notification):
email = models.EmailField()

def __str__(self):
return self.email


@python_2_unicode_compatible
class WebHook(Notification):
url = models.URLField(
max_length=600,
Expand All @@ -1189,7 +1187,6 @@ def __str__(self):
return self.url


@python_2_unicode_compatible
class Domain(models.Model):

"""A custom domain name for a project."""
Expand Down Expand Up @@ -1261,7 +1258,6 @@ def delete(self, *args, **kwargs): # pylint: disable=arguments-differ
super().delete(*args, **kwargs)


@python_2_unicode_compatible
class Feature(models.Model):

"""
Expand Down Expand Up @@ -1352,7 +1348,6 @@ def get_feature_display(self):
return dict(self.FEATURES).get(self.feature_id, self.feature_id)


@python_2_unicode_compatible
class EnvironmentVariable(TimeStampedModel, models.Model):
name = models.CharField(
max_length=128,
Expand Down
2 changes: 0 additions & 2 deletions readthedocs/redirects/models.py
Expand Up @@ -6,7 +6,6 @@
import re

from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext
from django.utils.translation import ugettext_lazy as _

Expand Down Expand Up @@ -52,7 +51,6 @@
redirect_type_helptext = _('The type of redirect you wish to use.')


@python_2_unicode_compatible
class Redirect(models.Model):

"""A HTTP redirect associated with a Project."""
Expand Down

0 comments on commit 70d4cc2

Please sign in to comment.