From a590eec7e75758971736a01c7aec5266935b1a4a Mon Sep 17 00:00:00 2001 From: hakancelik Date: Mon, 6 Jan 2020 18:36:12 +0300 Subject: #1081 :art: unimport applied --- isort/api.py | 4 +--- isort/compat.py | 7 ++----- isort/finders.py | 4 +--- isort/io.py | 2 +- isort/main.py | 2 +- isort/output.py | 2 +- isort/parse.py | 6 ++---- isort/settings.py | 7 ------- isort/sorting.py | 2 +- isort/wrap.py | 2 +- isort/wrap_modes.py | 4 ++-- pyproject.toml | 5 +++++ tests/test_output.py | 2 -- tests/test_wrap_modes.py | 2 -- 14 files changed, 18 insertions(+), 33 deletions(-) diff --git a/isort/api.py b/isort/api.py index bf86cd0e..49c693ae 100644 --- a/isort/api.py +++ b/isort/api.py @@ -1,9 +1,8 @@ -import re import textwrap from io import StringIO from itertools import chain from pathlib import Path -from typing import Any, List, NamedTuple, Optional, TextIO, Tuple +from typing import List, Optional, TextIO from . import output, parse from .exceptions import ( @@ -11,7 +10,6 @@ from .exceptions import ( FileSkipComment, FileSkipSetting, IntroducedSyntaxErrors, - UnableToDetermineEncoding, ) from .format import format_natural, remove_whitespace, show_unified_diff from .io import File diff --git a/isort/compat.py b/isort/compat.py index 9bc5aea8..3c202427 100644 --- a/isort/compat.py +++ b/isort/compat.py @@ -1,12 +1,9 @@ -import locale -import os -import re import sys from pathlib import Path -from typing import Any, Optional, Tuple +from typing import Any, Optional from warnings import warn -from . import api, settings +from . import api from .exceptions import ExistingSyntaxErrors, FileSkipped, IntroducedSyntaxErrors from .format import ask_whether_to_apply_changes_to_file, show_unified_diff from .io import File diff --git a/isort/finders.py b/isort/finders.py index 5a7c74a7..07219f07 100644 --- a/isort/finders.py +++ b/isort/finders.py @@ -11,12 +11,10 @@ from fnmatch import fnmatch from functools import lru_cache from glob import glob from typing import ( - Any, Dict, Iterable, Iterator, List, - Mapping, Optional, Pattern, Sequence, @@ -25,7 +23,7 @@ from typing import ( ) from . import sections -from .settings import DEFAULT_CONFIG, Config +from .settings import Config from .utils import chdir, exists_case_sensitive try: diff --git a/isort/io.py b/isort/io.py index 5845e9c1..bf993482 100644 --- a/isort/io.py +++ b/isort/io.py @@ -2,7 +2,7 @@ import locale import re from pathlib import Path -from typing import NamedTuple, Optional, Tuple +from typing import NamedTuple, Tuple from .exceptions import UnableToDetermineEncoding diff --git a/isort/main.py b/isort/main.py index 5d48f84c..dc2a4280 100644 --- a/isort/main.py +++ b/isort/main.py @@ -6,7 +6,7 @@ import os import re import sys from pathlib import Path -from typing import Any, Dict, Iterable, Iterator, List, MutableMapping, Optional, Sequence +from typing import Any, Dict, Iterable, Iterator, List, Optional, Sequence from warnings import warn import setuptools diff --git a/isort/output.py b/isort/output.py index 5f2659f7..d6a5f562 100644 --- a/isort/output.py +++ b/isort/output.py @@ -1,7 +1,7 @@ import copy import itertools from functools import partial -from typing import Any, Dict, Iterable, List, Optional +from typing import Iterable, List from isort.format import format_simplified diff --git a/isort/parse.py b/isort/parse.py index 8172808d..09e381be 100644 --- a/isort/parse.py +++ b/isort/parse.py @@ -1,11 +1,9 @@ """Defines parsing functions used by isort for parsing import definitions""" -from collections import OrderedDict, defaultdict, namedtuple -from io import StringIO +from collections import OrderedDict, defaultdict from itertools import chain -from typing import TYPE_CHECKING, Any, Dict, Generator, Iterator, List, NamedTuple, Optional, Tuple +from typing import TYPE_CHECKING, Any, Dict, List, NamedTuple, Optional, Tuple from warnings import warn -from isort.format import format_natural from isort.settings import DEFAULT_CONFIG, Config from .comments import parse as parse_comments diff --git a/isort/settings.py b/isort/settings.py index 04b488f1..1885eef3 100644 --- a/isort/settings.py +++ b/isort/settings.py @@ -6,11 +6,9 @@ Defines how the default settings for isort should be loaded in ~/.isort.cfg or $XDG_CONFIG_HOME/isort.cfg if there are any) """ import configparser -import enum import fnmatch import os import posixpath -import re import sys import warnings from distutils.util import strtobool as _as_bool @@ -23,12 +21,8 @@ from typing import ( FrozenSet, Iterable, List, - Mapping, - MutableMapping, - Optional, Set, Tuple, - Union, ) from warnings import warn @@ -37,7 +31,6 @@ from ._future import dataclass, field from .exceptions import ProfileDoesNotExist from .profiles import profiles from .sections import DEFAULT as SECTION_DEFAULTS -from .utils import difference, union from .wrap_modes import WrapModes from .wrap_modes import from_string as wrap_mode_from_string diff --git a/isort/sorting.py b/isort/sorting.py index e3aa277a..abd6bdbd 100644 --- a/isort/sorting.py +++ b/isort/sorting.py @@ -1,5 +1,5 @@ import re -from typing import Any, Callable, Iterable, List, Mapping, Optional +from typing import Any, Callable, Iterable, List, Optional from .settings import Config diff --git a/isort/wrap.py b/isort/wrap.py index db67f105..37bf6ec2 100644 --- a/isort/wrap.py +++ b/isort/wrap.py @@ -1,6 +1,6 @@ import copy import re -from typing import Any, Dict, List, Optional, Sequence +from typing import List, Optional, Sequence from .settings import DEFAULT_CONFIG, Config from .wrap_modes import WrapModes as Modes diff --git a/isort/wrap_modes.py b/isort/wrap_modes.py index d3d5a2ba..9b0a74b8 100644 --- a/isort/wrap_modes.py +++ b/isort/wrap_modes.py @@ -1,9 +1,9 @@ """Defines all wrap modes that can be used when outputting formatted imports""" import enum from inspect import signature -from typing import Any, Callable, Dict, List, Sequence +from typing import Any, Callable, Dict, List -from . import comments, settings +from . import comments _wrap_modes: Dict[str, Callable[[Any], str]] = {} diff --git a/pyproject.toml b/pyproject.toml index 0b25817e..60fb4bc2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -85,3 +85,8 @@ palette = {primary = "orange", accent = "indigo"} requires = ["poetry>=0.12"] build-backend = "poetry.masonry.api" +[tool.unimport] +files = [ + '.*(isort.py)', + '.*(__init__.py)', +] \ No newline at end of file diff --git a/tests/test_output.py b/tests/test_output.py index e42093b5..2457f70d 100644 --- a/tests/test_output.py +++ b/tests/test_output.py @@ -1,5 +1,3 @@ -import sys - from hypothesis_auto import auto_pytest_magic from isort import output diff --git a/tests/test_wrap_modes.py b/tests/test_wrap_modes.py index dee26d4f..203ba448 100644 --- a/tests/test_wrap_modes.py +++ b/tests/test_wrap_modes.py @@ -1,5 +1,3 @@ -import sys - from hypothesis_auto import auto_pytest_magic from isort import wrap_modes -- cgit v1.2.1 From ee6e7b236ed99393b24cfc643b0fc0dfbd0d8392 Mon Sep 17 00:00:00 2001 From: hakancelik Date: Mon, 6 Jan 2020 18:57:14 +0300 Subject: #1081 reset pyproject.toml --- pyproject.toml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 60fb4bc2..b379166c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -83,10 +83,4 @@ palette = {primary = "orange", accent = "indigo"} [build-system] requires = ["poetry>=0.12"] -build-backend = "poetry.masonry.api" - -[tool.unimport] -files = [ - '.*(isort.py)', - '.*(__init__.py)', -] \ No newline at end of file +build-backend = "poetry.masonry.api" \ No newline at end of file -- cgit v1.2.1 From 3a51988fa75d4e2b71c49764395c5c4564954490 Mon Sep 17 00:00:00 2001 From: hakancelik Date: Mon, 6 Jan 2020 18:58:57 +0300 Subject: #1081 reset pyproject.toml 2 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b379166c..59eb3718 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -83,4 +83,4 @@ palette = {primary = "orange", accent = "indigo"} [build-system] requires = ["poetry>=0.12"] -build-backend = "poetry.masonry.api" \ No newline at end of file +build-backend = "poetry.masonry.api" -- cgit v1.2.1 From b34705f87e38400e166ba83dd8ffd482bba260c1 Mon Sep 17 00:00:00 2001 From: Timothy Crosley Date: Tue, 7 Jan 2020 13:26:58 -0800 Subject: Fix formatting [isort + black] --- isort/finders.py | 12 +----------- isort/output.py | 1 + isort/settings.py | 11 +---------- isort/sorting.py | 2 +- 4 files changed, 4 insertions(+), 22 deletions(-) diff --git a/isort/finders.py b/isort/finders.py index 07219f07..259ddbb4 100644 --- a/isort/finders.py +++ b/isort/finders.py @@ -10,17 +10,7 @@ from abc import ABCMeta, abstractmethod from fnmatch import fnmatch from functools import lru_cache from glob import glob -from typing import ( - Dict, - Iterable, - Iterator, - List, - Optional, - Pattern, - Sequence, - Tuple, - Type, -) +from typing import Dict, Iterable, Iterator, List, Optional, Pattern, Sequence, Tuple, Type from . import sections from .settings import Config diff --git a/isort/output.py b/isort/output.py index e9a6f8bf..4343f71a 100644 --- a/isort/output.py +++ b/isort/output.py @@ -2,6 +2,7 @@ import copy import itertools from functools import partial from typing import Iterable, List, Tuple + from isort.format import format_simplified from . import parse, sorting, wrap diff --git a/isort/settings.py b/isort/settings.py index e05560dd..8858b20c 100644 --- a/isort/settings.py +++ b/isort/settings.py @@ -14,16 +14,7 @@ import warnings from distutils.util import strtobool as _as_bool from functools import lru_cache from pathlib import Path -from typing import ( - Any, - Callable, - Dict, - FrozenSet, - Iterable, - List, - Set, - Tuple, -) +from typing import Any, Callable, Dict, FrozenSet, Iterable, List, Set, Tuple from warnings import warn from . import stdlibs diff --git a/isort/sorting.py b/isort/sorting.py index abd6bdbd..34f88699 100644 --- a/isort/sorting.py +++ b/isort/sorting.py @@ -1,5 +1,5 @@ import re -from typing import Any, Callable, Iterable, List, Optional +from typing import Any, Callable, Iterable, List, Optional from .settings import Config -- cgit v1.2.1