summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhakancelik <hakancelik96@outlook.com>2020-01-06 18:36:12 +0300
committerhakancelik <hakancelik96@outlook.com>2020-01-06 18:36:12 +0300
commita590eec7e75758971736a01c7aec5266935b1a4a (patch)
treeb68b34a01cbf0eb4660efd950094414aeccc7b01
parentf02f012c7c13b8caa946d782ef8f6775972972bd (diff)
downloadisort-a590eec7e75758971736a01c7aec5266935b1a4a.tar.gz
#1081 :art: unimport applied
-rw-r--r--isort/api.py4
-rw-r--r--isort/compat.py7
-rw-r--r--isort/finders.py4
-rw-r--r--isort/io.py2
-rw-r--r--isort/main.py2
-rw-r--r--isort/output.py2
-rw-r--r--isort/parse.py6
-rw-r--r--isort/settings.py7
-rw-r--r--isort/sorting.py2
-rw-r--r--isort/wrap.py2
-rw-r--r--isort/wrap_modes.py4
-rw-r--r--pyproject.toml5
-rw-r--r--tests/test_output.py2
-rw-r--r--tests/test_wrap_modes.py2
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