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.
This commit is contained in:
François Freitag
2020-11-11 12:00:27 +01:00
parent e2c969c495
commit 0949735210
206 changed files with 407 additions and 585 deletions

View File

@@ -11,7 +11,6 @@ from sphinx.writers.manpage import ManualPageTranslator
from sphinx.writers.texinfo import TexinfoTranslator
from sphinx.writers.text import TextTranslator
project = 'test'

View File

@@ -5,7 +5,6 @@ import os
import mod_resource
import mod_something
if __name__ == "__main__":
print("Hello, world! -> something returns: {}".format(mod_something.something()))

View File

@@ -1,4 +1,4 @@
from dummy import * # NOQA
from dummy import * # NOQA
def test():

View File

@@ -3,7 +3,6 @@ from io import StringIO
from sphinx.util import save_traceback # NOQA
__all__ = ['Class']
#: documentation for the integer

View File

@@ -1,6 +1,6 @@
from __future__ import annotations
from typing import overload
from typing import overload
myint = int

View File

@@ -1,5 +1,4 @@
from typing import TypeVar, Generic
from typing import Generic, TypeVar
T = TypeVar('T')

View File

@@ -1,4 +1,4 @@
from typing import List, Callable
from typing import Callable, List
#: A list of int
T = List[int]

View File

@@ -1,5 +1,6 @@
from .foo import bar
class foo:
"""docstring of target.name_conflict::foo."""
pass

View File

@@ -1,12 +1,12 @@
import missing_module # NOQA
import missing_package1.missing_module1 # NOQA
from missing_module import missing_name # NOQA
from missing_package2 import missing_module2 # NOQA
from missing_package3.missing_module3 import missing_name # NOQA
import missing_module # NOQA
import missing_package1.missing_module1 # NOQA
from missing_module import missing_name # NOQA
from missing_package2 import missing_module2 # NOQA
from missing_package3.missing_module3 import missing_name # NOQA
import sphinx.missing_module4 # NOQA
from sphinx.missing_module4 import missing_name2 # NOQA
import sphinx.missing_module4 # NOQA
from sphinx.missing_module4 import missing_name2 # NOQA
@missing_name

View File

@@ -1,5 +1,5 @@
from functools import singledispatch
import inspect
from functools import singledispatch
def assign_signature(func):

View File

@@ -1,5 +1,6 @@
import os
import sys
sys.path.insert(0, os.path.abspath('.'))
extensions = ['sphinx.ext.autosummary']

View File

@@ -1,5 +1,6 @@
import os
import sys
sys.path.insert(0, os.path.abspath('.'))
extensions = ['sphinx.ext.autosummary']

View File

@@ -1,7 +1,6 @@
from os import path # NOQA
from typing import Union
#: module variable
CONSTANT1 = None
CONSTANT2 = None

View File

@@ -1 +1 @@
from .submodule import func1, Class1 # NOQA
from .submodule import Class1, func1 # NOQA

View File

@@ -1,2 +1,2 @@
from .mod1 import func1, Class1 # NOQA
from .mod2 import func2, Class2 # NOQA
from .mod1 import Class1, func1 # NOQA
from .mod2 import Class2, func2 # NOQA

View File

@@ -1,2 +1,3 @@
from spam.mod1 import Class3
__all__ = ('Class3',)

View File

@@ -1,5 +1,6 @@
import os
import sys
sys.path.insert(0, os.path.abspath('.'))

View File

@@ -1,5 +1,4 @@
from setuptools import setup
setup(name='sample',
py_modules=['sample'])

View File

@@ -1,7 +1,6 @@
import enum
from io import StringIO
__all__ = ['Class']
#: documentation for the integer

View File

@@ -6,7 +6,6 @@ from docutils.parsers.rst import Directive
from sphinx import addnodes
sys.path.append(os.path.abspath('.'))
extensions = ['sphinx.ext.autodoc',

View File

@@ -1,4 +1,4 @@
from setuptools import setup, find_packages
from setuptools import find_packages, setup
setup(
name='test-theme',

View File

@@ -1,5 +1,6 @@
import os
import sys
sys.path.append(os.path.abspath('.'))
extensions = ['sphinx.ext.autodoc']