summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Edmund Crosley <timothy.crosley@gmail.com>2020-01-07 13:45:14 -0800
committerGitHub <noreply@github.com>2020-01-07 13:45:14 -0800
commit0ee43b6a4f3c40876c3c7714846ecf8e584dc314 (patch)
treec1f81c534eac3282b9a273d827920cd21270e25b
parent9b654e379e4f92ee0bd73c079e2b5c11ed969ed1 (diff)
parentb34705f87e38400e166ba83dd8ffd482bba260c1 (diff)
downloadisort-0ee43b6a4f3c40876c3c7714846ecf8e584dc314.tar.gz
Merge pull request #1086 from timothycrosley/hakancelik96-issues/1081
Hakancelik96 issues/1081
-rw-r--r--isort/api.py4
-rw-r--r--isort/compat.py7
-rw-r--r--isort/finders.py16
-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.py18
-rw-r--r--isort/sorting.py2
-rw-r--r--isort/wrap.py2
-rw-r--r--isort/wrap_modes.py4
-rw-r--r--pyproject.toml1
-rw-r--r--tests/test_output.py2
-rw-r--r--tests/test_wrap_modes.py2
14 files changed, 15 insertions, 55 deletions
diff --git a/isort/api.py b/isort/api.py
index 004c5f5b..0ea7187f 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..259ddbb4 100644
--- a/isort/finders.py
+++ b/isort/finders.py
@@ -10,22 +10,10 @@ from abc import ABCMeta, abstractmethod
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,
- Tuple,
- Type,
-)
+from typing import Dict, Iterable, Iterator, List, Optional, Pattern, Sequence, Tuple, Type
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 459e786e..0bbf3353 100644
--- a/isort/main.py
+++ b/isort/main.py
@@ -7,7 +7,7 @@ import re
import stat
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 27fbd397..4343f71a 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, Tuple
+from typing import Iterable, List, Tuple
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 f51d78c8..8858b20c 100644
--- a/isort/settings.py
+++ b/isort/settings.py
@@ -6,30 +6,15 @@ 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
from functools import lru_cache
from pathlib import Path
-from typing import (
- Any,
- Callable,
- Dict,
- FrozenSet,
- Iterable,
- List,
- Mapping,
- MutableMapping,
- Optional,
- Set,
- Tuple,
- Union,
-)
+from typing import Any, Callable, Dict, FrozenSet, Iterable, List, Set, Tuple
from warnings import warn
from . import stdlibs
@@ -37,7 +22,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..34f88699 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..59eb3718 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -84,4 +84,3 @@ palette = {primary = "orange", accent = "indigo"}
[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
-
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