diff options
author | François Freitag <mail@franek.fr> | 2020-11-11 14:00:27 +0300 |
---|---|---|
committer | François Freitag <mail@franek.fr> | 2020-11-11 15:19:05 +0300 |
commit | 0949735210abaa05b6448e531984f159403053f4 (patch) | |
tree | 3561f378bc9fa97a73ad5b298e4bcd669827a044 /sphinx/pycode | |
parent | e2c969c4955662a8c5e4da8b77672aaaa7729359 (diff) |
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.
Diffstat (limited to 'sphinx/pycode')
-rw-r--r-- | sphinx/pycode/__init__.py | 2 | ||||
-rw-r--r-- | sphinx/pycode/ast.py | 2 | ||||
-rw-r--r-- | sphinx/pycode/parser.py | 3 |
3 files changed, 3 insertions, 4 deletions
diff --git a/sphinx/pycode/__init__.py b/sphinx/pycode/__init__.py index 4fef4a394..471ee675a 100644 --- a/sphinx/pycode/__init__.py +++ b/sphinx/pycode/__init__.py @@ -16,7 +16,7 @@ from importlib import import_module from inspect import Signature from io import StringIO from os import path -from typing import Any, Dict, IO, List, Tuple, Optional +from typing import IO, Any, Dict, List, Optional, Tuple from zipfile import ZipFile from sphinx.deprecation import RemovedInSphinx40Warning diff --git a/sphinx/pycode/ast.py b/sphinx/pycode/ast.py index 17d78f4eb..e8b0832ea 100644 --- a/sphinx/pycode/ast.py +++ b/sphinx/pycode/ast.py @@ -9,7 +9,7 @@ """ import sys -from typing import Dict, List, Type, Optional +from typing import Dict, List, Optional, Type if sys.version_info > (3, 8): import ast 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*(#.*)?$') |