From 0949735210abaa05b6448e531984f159403053f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Freitag?= Date: Wed, 11 Nov 2020 12:00:27 +0100 Subject: Sort imports with isort Keep imports alphabetically sorted and their order homogeneous across Python source files. The isort project has more feature and is more active than the flake8-import-order plugin. Most issues caught were simply import ordering from the same module. Where imports were purposefully placed out of order, tag with isort:skip. --- sphinx/pycode/parser.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'sphinx/pycode/parser.py') diff --git a/sphinx/pycode/parser.py b/sphinx/pycode/parser.py index be9bfc96d..d24012111 100644 --- a/sphinx/pycode/parser.py +++ b/sphinx/pycode/parser.py @@ -14,14 +14,13 @@ import sys import tokenize from collections import OrderedDict from inspect import Signature -from token import NAME, NEWLINE, INDENT, DEDENT, NUMBER, OP, STRING +from token import DEDENT, INDENT, NAME, NEWLINE, NUMBER, OP, STRING from tokenize import COMMENT, NL from typing import Any, Dict, List, Optional, Tuple from sphinx.pycode.ast import ast # for py37 or older from sphinx.pycode.ast import parse, unparse - comment_re = re.compile('^\\s*#: ?(.*)\r?\n?$') indent_re = re.compile('^\\s*$') emptyline_re = re.compile('^\\s*(#.*)?$') -- cgit v1.2.1