From 244d233c1e94b22c9cb2f712e76b84e5f8ce2b72 Mon Sep 17 00:00:00 2001 From: Asif Saif Uddin Date: Thu, 25 Oct 2018 11:00:33 +0600 Subject: [PATCH] dropped python 2.7 compat code --- rest_framework/authentication.py | 1 - rest_framework/authtoken/migrations/0001_initial.py | 3 --- .../authtoken/migrations/0002_auto_20160226_1747.py | 3 --- rest_framework/compat.py | 2 -- rest_framework/decorators.py | 1 - rest_framework/exceptions.py | 1 - rest_framework/fields.py | 2 -- rest_framework/filters.py | 1 - rest_framework/generics.py | 1 - rest_framework/metadata.py | 1 - rest_framework/mixins.py | 1 - rest_framework/negotiation.py | 1 - rest_framework/pagination.py | 1 - rest_framework/parsers.py | 1 - rest_framework/permissions.py | 1 - rest_framework/relations.py | 3 --- rest_framework/renderers.py | 1 - rest_framework/request.py | 1 - rest_framework/response.py | 1 - rest_framework/reverse.py | 1 - rest_framework/routers.py | 1 - rest_framework/schemas/inspectors.py | 1 - rest_framework/serializers.py | 1 - rest_framework/settings.py | 1 - rest_framework/status.py | 1 - rest_framework/templatetags/rest_framework.py | 2 -- rest_framework/test.py | 4 +--- rest_framework/throttling.py | 1 - rest_framework/urlpatterns.py | 2 -- rest_framework/urls.py | 1 - rest_framework/utils/breadcrumbs.py | 2 -- rest_framework/utils/encoders.py | 2 -- rest_framework/utils/formatting.py | 1 - rest_framework/utils/json.py | 2 -- rest_framework/utils/mediatypes.py | 1 - rest_framework/utils/representation.py | 1 - rest_framework/utils/serializer_helpers.py | 2 -- rest_framework/validators.py | 1 - rest_framework/versioning.py | 3 --- rest_framework/views.py | 1 - rest_framework/viewsets.py | 1 - 41 files changed, 1 insertion(+), 59 deletions(-) diff --git a/rest_framework/authentication.py b/rest_framework/authentication.py index 25150d5255..414f4c8f73 100644 --- a/rest_framework/authentication.py +++ b/rest_framework/authentication.py @@ -1,7 +1,6 @@ """ Provides various authentication policies. """ -from __future__ import unicode_literals import base64 import binascii diff --git a/rest_framework/authtoken/migrations/0001_initial.py b/rest_framework/authtoken/migrations/0001_initial.py index 75780fedf2..6a46ccfffe 100644 --- a/rest_framework/authtoken/migrations/0001_initial.py +++ b/rest_framework/authtoken/migrations/0001_initial.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - from django.conf import settings from django.db import migrations, models diff --git a/rest_framework/authtoken/migrations/0002_auto_20160226_1747.py b/rest_framework/authtoken/migrations/0002_auto_20160226_1747.py index 9f7e58e226..43119099a3 100644 --- a/rest_framework/authtoken/migrations/0002_auto_20160226_1747.py +++ b/rest_framework/authtoken/migrations/0002_auto_20160226_1747.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - from django.conf import settings from django.db import migrations, models diff --git a/rest_framework/compat.py b/rest_framework/compat.py index 1d34828bdc..07b7301c75 100644 --- a/rest_framework/compat.py +++ b/rest_framework/compat.py @@ -3,8 +3,6 @@ versions of Django/Python, and compatibility wrappers around optional packages. """ -from __future__ import unicode_literals - from django.conf import settings from django.core import validators from django.utils import six diff --git a/rest_framework/decorators.py b/rest_framework/decorators.py index f6d557d11f..94ee2bf94d 100644 --- a/rest_framework/decorators.py +++ b/rest_framework/decorators.py @@ -6,7 +6,6 @@ based views, as well as the `@detail_route` and `@list_route` decorators, which are used to annotate methods on viewsets that should be included by routers. """ -from __future__ import unicode_literals import types import warnings diff --git a/rest_framework/exceptions.py b/rest_framework/exceptions.py index f79b161294..0a26bb95c8 100644 --- a/rest_framework/exceptions.py +++ b/rest_framework/exceptions.py @@ -4,7 +4,6 @@ In addition Django's built in 403 and 404 exceptions are handled. (`django.http.Http404` and `django.core.exceptions.PermissionDenied`) """ -from __future__ import unicode_literals import math diff --git a/rest_framework/fields.py b/rest_framework/fields.py index 70c210c162..68736e5af4 100644 --- a/rest_framework/fields.py +++ b/rest_framework/fields.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import collections import copy import datetime diff --git a/rest_framework/filters.py b/rest_framework/filters.py index 0627bd8c4a..c931822823 100644 --- a/rest_framework/filters.py +++ b/rest_framework/filters.py @@ -2,7 +2,6 @@ Provides generic filtering backends that can be used to filter the results returned by list views. """ -from __future__ import unicode_literals import operator import warnings diff --git a/rest_framework/generics.py b/rest_framework/generics.py index 8d0bf284a9..2034827c1b 100644 --- a/rest_framework/generics.py +++ b/rest_framework/generics.py @@ -1,7 +1,6 @@ """ Generic views that provide commonly needed behaviour. """ -from __future__ import unicode_literals from django.core.exceptions import ValidationError from django.db.models.query import QuerySet diff --git a/rest_framework/metadata.py b/rest_framework/metadata.py index 9f93244693..04bef3c928 100644 --- a/rest_framework/metadata.py +++ b/rest_framework/metadata.py @@ -6,7 +6,6 @@ Future implementations might use JSON schema or other definitions in order to return this information in a more standardized way. """ -from __future__ import unicode_literals from collections import OrderedDict diff --git a/rest_framework/mixins.py b/rest_framework/mixins.py index de10d69308..8b868acb7c 100644 --- a/rest_framework/mixins.py +++ b/rest_framework/mixins.py @@ -4,7 +4,6 @@ We don't bind behaviour to http method handlers yet, which allows mixin classes to be composed in interesting ways. """ -from __future__ import unicode_literals from rest_framework import status from rest_framework.response import Response diff --git a/rest_framework/negotiation.py b/rest_framework/negotiation.py index ca1b59f12e..4897f63a74 100644 --- a/rest_framework/negotiation.py +++ b/rest_framework/negotiation.py @@ -2,7 +2,6 @@ Content negotiation deals with selecting an appropriate renderer given the incoming request. Typically this will be based on the request's Accept header. """ -from __future__ import unicode_literals from django.http import Http404 diff --git a/rest_framework/pagination.py b/rest_framework/pagination.py index b11d7cdf3a..857063ec8c 100644 --- a/rest_framework/pagination.py +++ b/rest_framework/pagination.py @@ -3,7 +3,6 @@ Pagination serializers determine the structure of the output that should be used for paginated responses. """ -from __future__ import unicode_literals from base64 import b64decode, b64encode from collections import OrderedDict, namedtuple diff --git a/rest_framework/parsers.py b/rest_framework/parsers.py index 35d0d1aa70..28902c725d 100644 --- a/rest_framework/parsers.py +++ b/rest_framework/parsers.py @@ -4,7 +4,6 @@ They give us a generic way of being able to handle various media types on the request, such as form content or json encoded data. """ -from __future__ import unicode_literals import codecs diff --git a/rest_framework/permissions.py b/rest_framework/permissions.py index dfe89ed2a6..f3f6e61db6 100644 --- a/rest_framework/permissions.py +++ b/rest_framework/permissions.py @@ -1,7 +1,6 @@ """ Provides a set of pluggable permission policies. """ -from __future__ import unicode_literals from django.http import Http404 from django.utils import six diff --git a/rest_framework/relations.py b/rest_framework/relations.py index e8a4ec2ac3..5b02507454 100644 --- a/rest_framework/relations.py +++ b/rest_framework/relations.py @@ -1,6 +1,3 @@ -# coding: utf-8 -from __future__ import unicode_literals - import sys from collections import OrderedDict diff --git a/rest_framework/renderers.py b/rest_framework/renderers.py index 375c38a857..155d18c930 100644 --- a/rest_framework/renderers.py +++ b/rest_framework/renderers.py @@ -6,7 +6,6 @@ REST framework also provides an HTML renderer that renders the browsable API. """ -from __future__ import unicode_literals import base64 from collections import OrderedDict diff --git a/rest_framework/request.py b/rest_framework/request.py index a6d92e2bdc..d87922930f 100644 --- a/rest_framework/request.py +++ b/rest_framework/request.py @@ -8,7 +8,6 @@ - full support of PUT method, including support for file uploads - form overloading of HTTP method, content type and content """ -from __future__ import unicode_literals import io import sys diff --git a/rest_framework/response.py b/rest_framework/response.py index bf06632557..a8677199be 100644 --- a/rest_framework/response.py +++ b/rest_framework/response.py @@ -4,7 +4,6 @@ The appropriate renderer is called during Django's template response rendering. """ -from __future__ import unicode_literals from django.template.response import SimpleTemplateResponse from django.utils import six diff --git a/rest_framework/reverse.py b/rest_framework/reverse.py index e9cf737f19..1e0d8b43d3 100644 --- a/rest_framework/reverse.py +++ b/rest_framework/reverse.py @@ -1,7 +1,6 @@ """ Provide urlresolver functions that return fully qualified URLs or view names """ -from __future__ import unicode_literals from django.urls import NoReverseMatch from django.urls import reverse as django_reverse diff --git a/rest_framework/routers.py b/rest_framework/routers.py index de04cb6740..40377015a9 100644 --- a/rest_framework/routers.py +++ b/rest_framework/routers.py @@ -13,7 +13,6 @@ urlpatterns = router.urls """ -from __future__ import unicode_literals import itertools import warnings diff --git a/rest_framework/schemas/inspectors.py b/rest_framework/schemas/inspectors.py index 02a38f3511..9239361e84 100644 --- a/rest_framework/schemas/inspectors.py +++ b/rest_framework/schemas/inspectors.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ inspectors.py # Per-endpoint view introspection diff --git a/rest_framework/serializers.py b/rest_framework/serializers.py index 110ffbfa98..a4595e70b3 100644 --- a/rest_framework/serializers.py +++ b/rest_framework/serializers.py @@ -10,7 +10,6 @@ 2. The process of marshalling between python primitives and request and response content is handled by parsers and renderers. """ -from __future__ import unicode_literals import copy import inspect diff --git a/rest_framework/settings.py b/rest_framework/settings.py index 8db9c81eda..f04a6b57f0 100644 --- a/rest_framework/settings.py +++ b/rest_framework/settings.py @@ -18,7 +18,6 @@ REST framework settings, checking for user settings first, then falling back to the defaults. """ -from __future__ import unicode_literals from importlib import import_module diff --git a/rest_framework/status.py b/rest_framework/status.py index 4b4561cfcd..1489b440cf 100644 --- a/rest_framework/status.py +++ b/rest_framework/status.py @@ -5,7 +5,6 @@ And RFC 6585 - https://tools.ietf.org/html/rfc6585 And RFC 4918 - https://tools.ietf.org/html/rfc4918 """ -from __future__ import unicode_literals def is_informational(code): diff --git a/rest_framework/templatetags/rest_framework.py b/rest_framework/templatetags/rest_framework.py index 3923389737..0a63eaed3c 100644 --- a/rest_framework/templatetags/rest_framework.py +++ b/rest_framework/templatetags/rest_framework.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import, unicode_literals - import re from collections import OrderedDict diff --git a/rest_framework/test.py b/rest_framework/test.py index edacf0066d..b319a4fc5a 100644 --- a/rest_framework/test.py +++ b/rest_framework/test.py @@ -1,8 +1,6 @@ -# -- coding: utf-8 -- - # Note that we import as `DjangoRequestFactory` and `DjangoClient` in order # to make it harder for the user to import the wrong thing without realizing. -from __future__ import unicode_literals + import io from importlib import import_module diff --git a/rest_framework/throttling.py b/rest_framework/throttling.py index 834ced148e..3bb14eacc0 100644 --- a/rest_framework/throttling.py +++ b/rest_framework/throttling.py @@ -1,7 +1,6 @@ """ Provides various throttling policies. """ -from __future__ import unicode_literals import time diff --git a/rest_framework/urlpatterns.py b/rest_framework/urlpatterns.py index ab3a74978f..831d344ddc 100644 --- a/rest_framework/urlpatterns.py +++ b/rest_framework/urlpatterns.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from django.conf.urls import include, url from rest_framework.compat import ( diff --git a/rest_framework/urls.py b/rest_framework/urls.py index 0e4c2661bd..521a3db759 100644 --- a/rest_framework/urls.py +++ b/rest_framework/urls.py @@ -11,7 +11,6 @@ You should make sure your authentication settings include `SessionAuthentication`. """ -from __future__ import unicode_literals from django.conf.urls import url from django.contrib.auth import views diff --git a/rest_framework/utils/breadcrumbs.py b/rest_framework/utils/breadcrumbs.py index e0374ffd00..54990e9f6c 100644 --- a/rest_framework/utils/breadcrumbs.py +++ b/rest_framework/utils/breadcrumbs.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from django.urls import get_script_prefix, resolve diff --git a/rest_framework/utils/encoders.py b/rest_framework/utils/encoders.py index d8f4aeb4eb..faf9a08c8f 100644 --- a/rest_framework/utils/encoders.py +++ b/rest_framework/utils/encoders.py @@ -1,8 +1,6 @@ """ Helper classes for parsers. """ -from __future__ import absolute_import, unicode_literals - import datetime import decimal import json # noqa diff --git a/rest_framework/utils/formatting.py b/rest_framework/utils/formatting.py index aa805f14e3..0c58665a8e 100644 --- a/rest_framework/utils/formatting.py +++ b/rest_framework/utils/formatting.py @@ -1,7 +1,6 @@ """ Utility functions to return a formatted name and description for a given view. """ -from __future__ import unicode_literals import re diff --git a/rest_framework/utils/json.py b/rest_framework/utils/json.py index cb55723801..82b306ddab 100644 --- a/rest_framework/utils/json.py +++ b/rest_framework/utils/json.py @@ -6,8 +6,6 @@ handled by users at the renderer and parser layer. """ -from __future__ import absolute_import - import functools import json # noqa diff --git a/rest_framework/utils/mediatypes.py b/rest_framework/utils/mediatypes.py index f4acf4807e..1754fba53b 100644 --- a/rest_framework/utils/mediatypes.py +++ b/rest_framework/utils/mediatypes.py @@ -3,7 +3,6 @@ See https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7 """ -from __future__ import unicode_literals from django.http.multipartparser import parse_header from django.utils.encoding import python_2_unicode_compatible diff --git a/rest_framework/utils/representation.py b/rest_framework/utils/representation.py index deeaf1f63f..6290065e3c 100644 --- a/rest_framework/utils/representation.py +++ b/rest_framework/utils/representation.py @@ -2,7 +2,6 @@ Helper functions for creating user-friendly representations of serializer classes and serializer fields. """ -from __future__ import unicode_literals import re diff --git a/rest_framework/utils/serializer_helpers.py b/rest_framework/utils/serializer_helpers.py index 6b662a66ca..068a37692c 100644 --- a/rest_framework/utils/serializer_helpers.py +++ b/rest_framework/utils/serializer_helpers.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import collections from collections import OrderedDict diff --git a/rest_framework/validators.py b/rest_framework/validators.py index 2ea3e5ac15..df8ac8bcdf 100644 --- a/rest_framework/validators.py +++ b/rest_framework/validators.py @@ -6,7 +6,6 @@ object creation, and makes it possible to switch between using the implicit `ModelSerializer` class and an equivalent explicit `Serializer` class. """ -from __future__ import unicode_literals from django.db import DataError from django.utils.translation import ugettext_lazy as _ diff --git a/rest_framework/versioning.py b/rest_framework/versioning.py index 5c9a7ade12..a98fdcd5fd 100644 --- a/rest_framework/versioning.py +++ b/rest_framework/versioning.py @@ -1,6 +1,3 @@ -# coding: utf-8 -from __future__ import unicode_literals - import re from django.utils.translation import ugettext_lazy as _ diff --git a/rest_framework/views.py b/rest_framework/views.py index 04951ed93d..ccc6029829 100644 --- a/rest_framework/views.py +++ b/rest_framework/views.py @@ -1,7 +1,6 @@ """ Provides an APIView class that is the base of all views in REST framework. """ -from __future__ import unicode_literals from django.conf import settings from django.core.exceptions import PermissionDenied diff --git a/rest_framework/viewsets.py b/rest_framework/viewsets.py index 7146828d2f..fa99e6e3d3 100644 --- a/rest_framework/viewsets.py +++ b/rest_framework/viewsets.py @@ -16,7 +16,6 @@ router.register(r'users', UserViewSet, 'user') urlpatterns = router.urls """ -from __future__ import unicode_literals from collections import OrderedDict from functools import update_wrapper