Skip to content

Commit 70d4cc2

Browse files
authored
Merge pull request #5241 from rtfd/humitos/remove-py2-compatibility
Remove py2 compatibility
2 parents a083eca + 9e697d3 commit 70d4cc2

File tree

7 files changed

+8
-27
lines changed

7 files changed

+8
-27
lines changed

readthedocs/builds/models.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from django.db import models
1212
from django.urls import reverse
1313
from django.utils import timezone
14-
from django.utils.encoding import python_2_unicode_compatible
1514
from django.utils.translation import ugettext
1615
from django.utils.translation import ugettext_lazy as _
1716
from guardian.shortcuts import assign
@@ -58,7 +57,6 @@
5857
log = logging.getLogger(__name__)
5958

6059

61-
@python_2_unicode_compatible
6260
class Version(models.Model):
6361

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

477475

478-
@python_2_unicode_compatible
479476
class Build(models.Model):
480477

481478
"""Build data."""
@@ -602,10 +599,12 @@ def save(self, *args, **kwargs): # noqa
602599
"""
603600
if self.pk is None or self._config_changed:
604601
previous = self.previous
602+
# yapf: disable
605603
if (
606604
previous is not None and self._config and
607605
self._config == previous.config
608606
):
607+
# yapf: enable
609608
previous_pk = previous._config.get(self.CONFIG_KEY, previous.pk)
610609
self._config = {self.CONFIG_KEY: previous_pk}
611610
super().save(*args, **kwargs)
@@ -655,7 +654,6 @@ def failed(self):
655654
return not self.successful
656655

657656

658-
@python_2_unicode_compatible
659657
class BuildCommandResult(BuildCommandResultMixin, models.Model):
660658

661659
"""Build command for a ``Build``."""

readthedocs/core/models.py

-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from annoying.fields import AutoOneToOneField
77
from django.db import models
88
from django.urls import reverse
9-
from django.utils.encoding import python_2_unicode_compatible
109
from django.utils.translation import ugettext
1110
from django.utils.translation import ugettext_lazy as _
1211

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

1817

19-
@python_2_unicode_compatible
2018
class UserProfile(models.Model):
2119

2220
"""Additional information about a User."""

readthedocs/gold/models.py

-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import math
55

66
from django.db import models
7-
from django.utils.encoding import python_2_unicode_compatible
87
from django.utils.translation import ugettext_lazy as _
98

109
from readthedocs.projects.models import Project
@@ -24,7 +23,6 @@
2423
DOLLARS_PER_PROJECT = 5
2524

2625

27-
@python_2_unicode_compatible
2826
class GoldUser(models.Model):
2927

3028
"""A user subscription for gold membership."""

readthedocs/integrations/models.py

-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
)
1313
from django.contrib.contenttypes.models import ContentType
1414
from django.db import models, transaction
15-
from django.utils.encoding import python_2_unicode_compatible
1615
from django.utils.safestring import mark_safe
1716
from django.utils.translation import ugettext_lazy as _
1817
from jsonfield import JSONField
@@ -112,7 +111,6 @@ def delete_limit(self, related_object, limit=10):
112111
exchange.delete()
113112

114113

115-
@python_2_unicode_compatible
116114
class HttpExchange(models.Model):
117115

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

232230

233-
@python_2_unicode_compatible
234231
class Integration(models.Model):
235232

236233
"""Inbound webhook integration for projects."""

readthedocs/oauth/models.py

-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
from django.db import models
1111
from django.db.models import Q
1212
from django.urls import reverse
13-
from django.utils.encoding import python_2_unicode_compatible
1413
from django.utils.translation import ugettext_lazy as _
1514

1615
from readthedocs.projects.constants import REPO_CHOICES
@@ -19,7 +18,6 @@
1918
from .querysets import RemoteOrganizationQuerySet, RemoteRepositoryQuerySet
2019

2120

22-
@python_2_unicode_compatible
2321
class RemoteOrganization(models.Model):
2422

2523
"""
@@ -74,7 +72,6 @@ def get_serialized(self, key=None, default=None):
7472
pass
7573

7674

77-
@python_2_unicode_compatible
7875
class RemoteRepository(models.Model):
7976

8077
"""

readthedocs/projects/models.py

+6-11
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@
44

55
import fnmatch
66
import logging
7-
import re
87
import os
8+
import re
99
from urllib.parse import urlparse
1010

1111
from django.conf import settings
1212
from django.contrib.auth.models import User
1313
from django.db import models
1414
from django.urls import NoReverseMatch, reverse
15-
from django.utils.encoding import python_2_unicode_compatible
1615
from django.utils.functional import cached_property
1716
from django.utils.translation import ugettext_lazy as _
1817
from django_extensions.db.models import TimeStampedModel
@@ -47,7 +46,6 @@
4746
log = logging.getLogger(__name__)
4847

4948

50-
@python_2_unicode_compatible
5149
class ProjectRelationship(models.Model):
5250

5351
"""
@@ -89,7 +87,6 @@ def get_absolute_url(self):
8987
return resolve(self.child)
9088

9189

92-
@python_2_unicode_compatible
9390
class Project(models.Model):
9491

9592
"""Project model."""
@@ -1070,7 +1067,6 @@ def environment_variables(self):
10701067
return self._environment_variables
10711068

10721069

1073-
@python_2_unicode_compatible
10741070
class ImportedFile(models.Model):
10751071

10761072
"""
@@ -1127,7 +1123,11 @@ def json_file_path(self):
11271123
basename = os.path.splitext(self.path)[0]
11281124
if self.project.documentation_type == 'sphinx_htmldir' and basename.endswith('/index'):
11291125
new_basename = re.sub(r'\/index$', '', basename)
1130-
log.info('Adjusted json file path: %s -> %s', basename, new_basename)
1126+
log.info(
1127+
'Adjusted json file path: %s -> %s',
1128+
basename,
1129+
new_basename,
1130+
)
11311131
basename = new_basename
11321132

11331133
file_path = basename + '.fjson'
@@ -1169,15 +1169,13 @@ class Meta:
11691169
abstract = True
11701170

11711171

1172-
@python_2_unicode_compatible
11731172
class EmailHook(Notification):
11741173
email = models.EmailField()
11751174

11761175
def __str__(self):
11771176
return self.email
11781177

11791178

1180-
@python_2_unicode_compatible
11811179
class WebHook(Notification):
11821180
url = models.URLField(
11831181
max_length=600,
@@ -1189,7 +1187,6 @@ def __str__(self):
11891187
return self.url
11901188

11911189

1192-
@python_2_unicode_compatible
11931190
class Domain(models.Model):
11941191

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

12631260

1264-
@python_2_unicode_compatible
12651261
class Feature(models.Model):
12661262

12671263
"""
@@ -1352,7 +1348,6 @@ def get_feature_display(self):
13521348
return dict(self.FEATURES).get(self.feature_id, self.feature_id)
13531349

13541350

1355-
@python_2_unicode_compatible
13561351
class EnvironmentVariable(TimeStampedModel, models.Model):
13571352
name = models.CharField(
13581353
max_length=128,

readthedocs/redirects/models.py

-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import re
77

88
from django.db import models
9-
from django.utils.encoding import python_2_unicode_compatible
109
from django.utils.translation import ugettext
1110
from django.utils.translation import ugettext_lazy as _
1211

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

5453

55-
@python_2_unicode_compatible
5654
class Redirect(models.Model):
5755

5856
"""A HTTP redirect associated with a Project."""

0 commit comments

Comments
 (0)