diff --git a/requirements/requirements-codestyle.txt b/requirements/requirements-codestyle.txt index d9efde1d0..434fc41af 100644 --- a/requirements/requirements-codestyle.txt +++ b/requirements/requirements-codestyle.txt @@ -4,4 +4,4 @@ flake8-tidy-imports==4.1.0 pycodestyle==2.5.0 # Sort and lint imports -isort==4.3.21 +isort==5.4.2 diff --git a/rest_framework/compat.py b/rest_framework/compat.py index 611068a62..4bae7729f 100644 --- a/rest_framework/compat.py +++ b/rest_framework/compat.py @@ -96,8 +96,8 @@ except ImportError: try: import pygments - from pygments.lexers import get_lexer_by_name, TextLexer from pygments.formatters import HtmlFormatter + from pygments.lexers import TextLexer, get_lexer_by_name def pygments_highlight(text, lang, style): lexer = get_lexer_by_name(lang, stripall=False) @@ -121,9 +121,10 @@ if markdown is not None and pygments is not None: # starting from this blogpost and modified to support current markdown extensions API # https://zerokspot.com/weblog/2008/06/18/syntax-highlighting-in-markdown-with-pygments/ - from markdown.preprocessors import Preprocessor import re + from markdown.preprocessors import Preprocessor + class CodeBlockPreprocessor(Preprocessor): pattern = re.compile( r'^\s*``` *([^\n]+)\n(.+?)^\s*```', re.M | re.S) diff --git a/runtests.py b/runtests.py index 19513cdbf..82028ea32 100755 --- a/runtests.py +++ b/runtests.py @@ -11,7 +11,7 @@ PYTEST_ARGS = { FLAKE8_ARGS = ['rest_framework', 'tests'] -ISORT_ARGS = ['--recursive', '--check-only', '--diff', 'rest_framework', 'tests'] +ISORT_ARGS = ['--check-only', '--diff', 'rest_framework', 'tests'] def exit_on_failure(ret, message=None): diff --git a/setup.cfg b/setup.cfg index 81da18b1c..abb7cca90 100644 --- a/setup.cfg +++ b/setup.cfg @@ -13,7 +13,7 @@ banned-modules = json = use from rest_framework.utils import json! skip=.tox atomic=true multi_line_output=5 -known_standard_library=types +extra_standard_library=types known_third_party=pytest,_pytest,django,pytz,uritemplate known_first_party=rest_framework,tests