Skip to content

Commit

Permalink
Refs #23919 -- Removed python_2_unicode_compatible decorator usage
Browse files Browse the repository at this point in the history
  • Loading branch information
claudep committed Jan 18, 2017
1 parent d7b9aaa commit f3c43ad
Show file tree
Hide file tree
Showing 160 changed files with 23 additions and 757 deletions.
3 changes: 1 addition & 2 deletions django/contrib/admin/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from django.db import models
from django.urls import NoReverseMatch, reverse
from django.utils import timezone
from django.utils.encoding import force_text, python_2_unicode_compatible
from django.utils.encoding import force_text
from django.utils.text import get_text_list
from django.utils.translation import ugettext, ugettext_lazy as _

Expand All @@ -31,7 +31,6 @@ def log_action(self, user_id, content_type_id, object_id, object_repr, action_fl
)


@python_2_unicode_compatible
class LogEntry(models.Model):
action_time = models.DateTimeField(
_('action time'),
Expand Down
3 changes: 1 addition & 2 deletions django/contrib/admin/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
from django.urls import reverse
from django.utils import six
from django.utils.decorators import method_decorator
from django.utils.encoding import force_text, python_2_unicode_compatible
from django.utils.encoding import force_text
from django.utils.html import format_html
from django.utils.http import urlencode, urlquote
from django.utils.safestring import mark_safe
Expand Down Expand Up @@ -480,7 +480,6 @@ def has_module_permission(self, request):
return request.user.has_module_perms(self.opts.app_label)


@python_2_unicode_compatible
class ModelAdmin(BaseModelAdmin):
"Encapsulates all admin options and functionality for a given model."

Expand Down
3 changes: 1 addition & 2 deletions django/contrib/auth/base_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
)
from django.db import models
from django.utils.crypto import get_random_string, salted_hmac
from django.utils.encoding import force_text, python_2_unicode_compatible
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _


Expand Down Expand Up @@ -45,7 +45,6 @@ def get_by_natural_key(self, username):
return self.get(**{self.model.USERNAME_FIELD: username})


@python_2_unicode_compatible
class AbstractBaseUser(models.Model):
password = models.CharField(_('password'), max_length=128)
last_login = models.DateTimeField(_('last login'), blank=True, null=True)
Expand Down
4 changes: 0 additions & 4 deletions django/contrib/auth/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from django.db import models
from django.db.models.manager import EmptyManager
from django.utils import six, timezone
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _

from .validators import ASCIIUsernameValidator, UnicodeUsernameValidator
Expand Down Expand Up @@ -35,7 +34,6 @@ def get_by_natural_key(self, codename, app_label, model):
)


@python_2_unicode_compatible
class Permission(models.Model):
"""
The permissions system provides a way to assign permissions to specific
Expand Down Expand Up @@ -96,7 +94,6 @@ def get_by_natural_key(self, name):
return self.get(name=name)


@python_2_unicode_compatible
class Group(models.Model):
"""
Groups are a generic way of categorizing users to apply permissions, or
Expand Down Expand Up @@ -374,7 +371,6 @@ class Meta(AbstractUser.Meta):
swappable = 'AUTH_USER_MODEL'


@python_2_unicode_compatible
class AnonymousUser(object):
id = None
pk = None
Expand Down
3 changes: 1 addition & 2 deletions django/contrib/contenttypes/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@
lazy_related_operation,
)
from django.db.models.query_utils import PathInfo
from django.utils.encoding import force_text, python_2_unicode_compatible
from django.utils.encoding import force_text
from django.utils.functional import cached_property


@python_2_unicode_compatible
class GenericForeignKey(object):
"""
Provide a generic many-to-one relation through the ``content_type`` and
Expand Down
3 changes: 1 addition & 2 deletions django/contrib/contenttypes/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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


Expand Down Expand Up @@ -133,7 +133,6 @@ def _add_to_cache(self, using, ct):
self._cache.setdefault(using, {})[ct.id] = ct


@python_2_unicode_compatible
class ContentType(models.Model):
app_label = models.CharField(max_length=100)
model = models.CharField(_('python model class name'), max_length=100)
Expand Down
3 changes: 1 addition & 2 deletions django/contrib/flatpages/models.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
from django.contrib.sites.models import Site
from django.db import models
from django.urls import get_script_prefix
from django.utils.encoding import iri_to_uri, python_2_unicode_compatible
from django.utils.encoding import iri_to_uri
from django.utils.translation import ugettext_lazy as _


@python_2_unicode_compatible
class FlatPage(models.Model):
url = models.CharField(_('URL'), max_length=100, db_index=True)
title = models.CharField(_('title'), max_length=200)
Expand Down
2 changes: 0 additions & 2 deletions django/contrib/gis/db/backends/base/models.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
from django.contrib.gis import gdal
from django.utils import six
from django.utils.encoding import python_2_unicode_compatible


@python_2_unicode_compatible
class SpatialRefSysMixin(object):
"""
The SpatialRefSysMixin is a class used by the database-dependent
Expand Down
2 changes: 0 additions & 2 deletions django/contrib/gis/db/backends/oracle/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@
"""
from django.contrib.gis.db import models
from django.contrib.gis.db.backends.base.models import SpatialRefSysMixin
from django.utils.encoding import python_2_unicode_compatible


@python_2_unicode_compatible
class OracleGeometryColumns(models.Model):
"Maps to the Oracle USER_SDO_GEOM_METADATA table."
table_name = models.CharField(max_length=32)
Expand Down
2 changes: 0 additions & 2 deletions django/contrib/gis/db/backends/postgis/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
"""
from django.contrib.gis.db.backends.base.models import SpatialRefSysMixin
from django.db import models
from django.utils.encoding import python_2_unicode_compatible


@python_2_unicode_compatible
class PostGISGeometryColumns(models.Model):
"""
The 'geometry_columns' view from PostGIS. See the PostGIS
Expand Down
2 changes: 0 additions & 2 deletions django/contrib/gis/db/backends/spatialite/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
"""
from django.contrib.gis.db.backends.base.models import SpatialRefSysMixin
from django.db import models
from django.utils.encoding import python_2_unicode_compatible


@python_2_unicode_compatible
class SpatialiteGeometryColumns(models.Model):
"""
The 'geometry_columns' table from SpatiaLite.
Expand Down
5 changes: 1 addition & 4 deletions django/contrib/gis/gdal/raster/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
from django.contrib.gis.gdal.srs import SpatialReference, SRSException
from django.contrib.gis.geometry.regex import json_regex
from django.utils import six
from django.utils.encoding import (
force_bytes, force_text, python_2_unicode_compatible,
)
from django.utils.encoding import force_bytes, force_text
from django.utils.functional import cached_property


Expand Down Expand Up @@ -52,7 +50,6 @@ def y(self, value):
self._raster.geotransform = gtf


@python_2_unicode_compatible
class GDALRaster(GDALBase):
"""
Wraps a raster GDAL Data Source object.
Expand Down
3 changes: 1 addition & 2 deletions django/contrib/messages/storage/base.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
from django.conf import settings
from django.contrib.messages import constants, utils
from django.utils.encoding import force_text, python_2_unicode_compatible
from django.utils.encoding import force_text

LEVEL_TAGS = utils.get_level_tags()


@python_2_unicode_compatible
class Message(object):
"""
Represents an actual message that can be stored in any of the supported
Expand Down
2 changes: 0 additions & 2 deletions django/contrib/redirects/models.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
from django.contrib.sites.models import Site
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _


@python_2_unicode_compatible
class Redirect(models.Model):
site = models.ForeignKey(Site, models.CASCADE, verbose_name=_('site'))
old_path = models.CharField(
Expand Down
2 changes: 0 additions & 2 deletions django/contrib/sessions/base_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
when django.contrib.sessions is not in INSTALLED_APPS.
"""
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _


Expand All @@ -24,7 +23,6 @@ def save(self, session_key, session_dict, expire_date):
return s


@python_2_unicode_compatible
class AbstractBaseSession(models.Model):
session_key = models.CharField(_('session key'), max_length=40, primary_key=True)
session_data = models.TextField(_('session data'))
Expand Down
2 changes: 0 additions & 2 deletions django/contrib/sites/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from django.db import models
from django.db.models.signals import pre_delete, pre_save
from django.http.request import split_domain_port
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _

SITE_CACHE = {}
Expand Down Expand Up @@ -78,7 +77,6 @@ def get_by_natural_key(self, domain):
return self.get(domain=domain)


@python_2_unicode_compatible
class Site(models.Model):

domain = models.CharField(
Expand Down
4 changes: 0 additions & 4 deletions django/contrib/sites/requests.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
from django.utils.encoding import python_2_unicode_compatible


@python_2_unicode_compatible
class RequestSite(object):
"""
A class that shares the primary interface of Site (i.e., it has
Expand Down
3 changes: 1 addition & 2 deletions django/core/checks/messages.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.utils.encoding import force_str, python_2_unicode_compatible
from django.utils.encoding import force_str

# Levels
DEBUG = 10
Expand All @@ -8,7 +8,6 @@
CRITICAL = 50


@python_2_unicode_compatible
class CheckMessage(object):

def __init__(self, level, msg, hint=None, obj=None, id=None):
Expand Down
6 changes: 1 addition & 5 deletions django/core/files/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@

from django.core.files.utils import FileProxyMixin
from django.utils import six
from django.utils.encoding import (
force_bytes, force_str, force_text, python_2_unicode_compatible,
)
from django.utils.encoding import force_bytes, force_str, force_text


@python_2_unicode_compatible
class File(FileProxyMixin):
DEFAULT_CHUNK_SIZE = 64 * 2 ** 10

Expand Down Expand Up @@ -138,7 +135,6 @@ def close(self):
self.file.close()


@python_2_unicode_compatible
class ContentFile(File):
"""
A File-like object that takes just raw content, rather than an actual file.
Expand Down
2 changes: 0 additions & 2 deletions django/core/files/uploadhandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from django.core.files.uploadedfile import (
InMemoryUploadedFile, TemporaryUploadedFile,
)
from django.utils.encoding import python_2_unicode_compatible
from django.utils.module_loading import import_string

__all__ = [
Expand All @@ -25,7 +24,6 @@ class UploadFileException(Exception):
pass


@python_2_unicode_compatible
class StopUpload(UploadFileException):
"""
This exception is raised when an upload must abort.
Expand Down
2 changes: 0 additions & 2 deletions django/db/migrations/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from django.db.utils import DatabaseError
from django.utils.encoding import python_2_unicode_compatible


class AmbiguityError(Exception):
Expand Down Expand Up @@ -44,7 +43,6 @@ class IrreversibleError(RuntimeError):
pass


@python_2_unicode_compatible
class NodeNotFoundError(LookupError):
"""
Raised when an attempt on a node is made that is not available in the graph.
Expand Down
3 changes: 0 additions & 3 deletions django/db/migrations/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from django.db.migrations.state import ProjectState
from django.utils import six
from django.utils.datastructures import OrderedSet
from django.utils.encoding import python_2_unicode_compatible

from .exceptions import CircularDependencyError, NodeNotFoundError

Expand All @@ -18,7 +17,6 @@
)


@python_2_unicode_compatible
@total_ordering
class Node(object):
"""
Expand Down Expand Up @@ -102,7 +100,6 @@ def raise_error(self):
raise NodeNotFoundError(self.error_message, self.key, origin=self.origin)


@python_2_unicode_compatible
class MigrationGraph(object):
"""
Represents the digraph of all migrations in a project.
Expand Down
2 changes: 0 additions & 2 deletions django/db/migrations/migration.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
from django.db.transaction import atomic
from django.utils.encoding import python_2_unicode_compatible

from .exceptions import IrreversibleError


@python_2_unicode_compatible
class Migration(object):
"""
The base class for all migrations.
Expand Down
2 changes: 0 additions & 2 deletions django/db/migrations/recorder.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from django.apps.registry import Apps
from django.db import models
from django.db.utils import DatabaseError
from django.utils.encoding import python_2_unicode_compatible
from django.utils.timezone import now

from .exceptions import MigrationSchemaMissing
Expand All @@ -20,7 +19,6 @@ class MigrationRecorder(object):
a row in the table always means a migration is applied.
"""

@python_2_unicode_compatible
class Migration(models.Model):
app = models.CharField(max_length=255)
name = models.CharField(max_length=255)
Expand Down
5 changes: 1 addition & 4 deletions django/db/models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,14 @@
)
from django.db.models.utils import make_model_tuple
from django.utils import six
from django.utils.encoding import (
force_str, force_text, python_2_unicode_compatible,
)
from django.utils.encoding import force_str, force_text
from django.utils.functional import curry
from django.utils.six.moves import zip
from django.utils.text import capfirst, get_text_list
from django.utils.translation import ugettext_lazy as _
from django.utils.version import get_version


@python_2_unicode_compatible
class Deferred(object):
def __repr__(self):
return str('<Deferred field>')
Expand Down
Loading

0 comments on commit f3c43ad

Please sign in to comment.