From 5a6747d02b39c673f85f34b225ff41ad216636b6 Mon Sep 17 00:00:00 2001 From: Asif Saif Uddin Date: Thu, 25 Oct 2018 14:27:54 +0600 Subject: [PATCH] dropped python 2.7 compat codes --- rest_framework/authtoken/models.py | 2 -- rest_framework/relations.py | 6 ++---- tests/test_description.py | 3 +-- tests/test_relations_generic.py | 4 ---- 4 files changed, 3 insertions(+), 12 deletions(-) diff --git a/rest_framework/authtoken/models.py b/rest_framework/authtoken/models.py index 7e96eff93..c2b5bd308 100644 --- a/rest_framework/authtoken/models.py +++ b/rest_framework/authtoken/models.py @@ -3,11 +3,9 @@ import os from django.conf import settings 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 Token(models.Model): """ The default authorization token model. diff --git a/rest_framework/relations.py b/rest_framework/relations.py index 5b0250745..0ab258ada 100644 --- a/rest_framework/relations.py +++ b/rest_framework/relations.py @@ -6,9 +6,8 @@ from django.db.models import Manager from django.db.models.query import QuerySet from django.urls import NoReverseMatch, Resolver404, get_script_prefix, resolve from django.utils import six -from django.utils.encoding import ( - python_2_unicode_compatible, smart_text, uri_to_iri -) +from django.utils.encoding import smart_text, uri_to_iri + from django.utils.six.moves.urllib import parse as urlparse from django.utils.translation import ugettext_lazy as _ @@ -67,7 +66,6 @@ class Hyperlink(six.text_type): is_hyperlink = True -@python_2_unicode_compatible class PKOnlyObject(object): """ This is a mock object, used for when we only need the pk of the object diff --git a/tests/test_description.py b/tests/test_description.py index 0a23747a4..65cf01aa6 100644 --- a/tests/test_description.py +++ b/tests/test_description.py @@ -1,5 +1,4 @@ from django.test import TestCase -from django.utils.encoding import python_2_unicode_compatible from rest_framework.compat import apply_markdown from rest_framework.utils.formatting import dedent @@ -153,7 +152,7 @@ class TestViewNamesAndDescriptions(TestCase): """ # use a mock object instead of gettext_lazy to ensure that we can't end # up with a test case string in our l10n catalog - @python_2_unicode_compatible + class MockLazyStr(object): def __init__(self, string): self.s = string diff --git a/tests/test_relations_generic.py b/tests/test_relations_generic.py index 3617b7094..c6f2b0de4 100644 --- a/tests/test_relations_generic.py +++ b/tests/test_relations_generic.py @@ -4,12 +4,10 @@ from django.contrib.contenttypes.fields import ( from django.contrib.contenttypes.models import ContentType from django.db import models from django.test import TestCase -from django.utils.encoding import python_2_unicode_compatible from rest_framework import serializers -@python_2_unicode_compatible class Tag(models.Model): """ Tags have a descriptive slug, and are attached to an arbitrary object. @@ -23,7 +21,6 @@ class Tag(models.Model): return self.tag -@python_2_unicode_compatible class Bookmark(models.Model): """ A URL bookmark that may have multiple tags attached. @@ -35,7 +32,6 @@ class Bookmark(models.Model): return 'Bookmark: %s' % self.url -@python_2_unicode_compatible class Note(models.Model): """ A textual note that may have multiple tags attached.