From 901657e7e8fe460cf9f14b48b9bce70d3cd06b09 Mon Sep 17 00:00:00 2001 From: Ryan P Kilby Date: Mon, 10 Jul 2017 17:22:55 -0400 Subject: [PATCH] Add banned imports to prevent standard json import --- requirements/requirements-codestyle.txt | 1 + rest_framework/utils/encoders.py | 2 +- rest_framework/utils/json.py | 2 +- setup.cfg | 1 + 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/requirements/requirements-codestyle.txt b/requirements/requirements-codestyle.txt index 264416f5f..9bafbe391 100644 --- a/requirements/requirements-codestyle.txt +++ b/requirements/requirements-codestyle.txt @@ -1,5 +1,6 @@ # PEP8 code linting, which we run on all commits. flake8==2.4.0 +flake8-tidy-imports==1.1.0 pep8==1.5.7 # Sort and lint imports diff --git a/rest_framework/utils/encoders.py b/rest_framework/utils/encoders.py index a4fe8d0c4..d754e4465 100644 --- a/rest_framework/utils/encoders.py +++ b/rest_framework/utils/encoders.py @@ -5,7 +5,7 @@ from __future__ import absolute_import, unicode_literals import datetime import decimal -import json +import json # noqa import uuid from django.db.models.query import QuerySet diff --git a/rest_framework/utils/json.py b/rest_framework/utils/json.py index cc7df542e..ea5e22725 100644 --- a/rest_framework/utils/json.py +++ b/rest_framework/utils/json.py @@ -2,7 +2,7 @@ from __future__ import absolute_import import functools -import json +import json # noqa def strict_constant(o): diff --git a/setup.cfg b/setup.cfg index 509abd58b..9f6b5be77 100644 --- a/setup.cfg +++ b/setup.cfg @@ -6,3 +6,4 @@ license_file = LICENSE.md [flake8] ignore = E501 +banned-modules = json = use from rest_framework.utils import json!