正确排序进口我试图做出了贡献,以Django的REST的架构,在认证文件进口我跑isort
后都是这样的(我已经添加进口6位):使用TOX
from __future__ import unicode_literals
import base64
import six
from django.contrib.auth import authenticate, get_user_model
from django.middleware.csrf import CsrfViewMiddleware
from django.utils.translation import ugettext_lazy as _
from rest_framework import HTTP_HEADER_ENCODING, exceptions
时我跑./runtests --lintonly
它通过了所有测试,但是当我运行tox
它给了我这个错误:
py27-lint runtests: commands[0] | ./runtests.py --lintonly
Running flake8 code linting
flake8 passed
Running isort code checking
ERROR: /home/nitesh/open_source/django-rest-framework/rest_framework/authentication.py Imports are incorrectly sorted.
isort failed: Some modules have incorrectly ordered imports. Fix by running `isort --recursive .`
ERROR: InvocationError: '/home/nitesh/open_source/django-rest-framework/runtests.py --lintonly'
你能分享你添加到Django的REST框架哪些代码。它可以帮助我重现问题并找到解决方案。 –
@Vinit这几乎是2行,'import six',并用authentication.py中的'six.string_types'替换type('')'。 – dnit13