diff options
| author | Timothy Crosley <timothy.crosley@gmail.com> | 2019-10-21 01:40:17 -0700 |
|---|---|---|
| committer | Timothy Crosley <timothy.crosley@gmail.com> | 2019-10-21 01:40:17 -0700 |
| commit | 26522ccfd6c4edd988d636eb146c511a28482fdf (patch) | |
| tree | aac17bc14c0b46876162ecc25cd401a458c4ac91 | |
| parent | 8f0d26f53dcf5d1f187d8c8f8b3374a28e54dd64 (diff) | |
| download | isort-26522ccfd6c4edd988d636eb146c511a28482fdf.tar.gz | |
Passing tests!
| -rw-r--r-- | .hypothesis/unicode_data/11.0.0/charmap.json.gz | bin | 20358 -> 0 bytes | |||
| -rw-r--r-- | isort/parse.py | 18 | ||||
| -rwxr-xr-x | scripts/clean.sh | 2 | ||||
| -rwxr-xr-x | scripts/mkstdlibs.py | 1 |
4 files changed, 10 insertions, 11 deletions
diff --git a/.hypothesis/unicode_data/11.0.0/charmap.json.gz b/.hypothesis/unicode_data/11.0.0/charmap.json.gz Binary files differdeleted file mode 100644 index b6e5fa9f..00000000 --- a/.hypothesis/unicode_data/11.0.0/charmap.json.gz +++ /dev/null diff --git a/isort/parse.py b/isort/parse.py index 02a14f65..4b036bdd 100644 --- a/isort/parse.py +++ b/isort/parse.py @@ -1,10 +1,10 @@ """Defines parsing functions used by isort for parsing import definitions""" -from collections import defaultdict, OrderedDict -from typing import Tuple, List, Generator, Iterator, TYPE_CHECKING, Optional, Any, Dict -from .finders import FindersManager +from collections import OrderedDict, defaultdict from itertools import chain +from typing import TYPE_CHECKING, Any, Dict, Generator, Iterator, List, Optional, Tuple from warnings import warn +from .finders import FindersManager if TYPE_CHECKING: from mypy_extensions import TypedDict @@ -321,17 +321,17 @@ def file_contents( if "as" in just_imports and (just_imports.index("as") + 1) < len(just_imports): straight_import = False while "as" in just_imports: - index = just_imports.index("as") + as_index = just_imports.index("as") if type_of_import == "from": - module = just_imports[0] + "." + just_imports[index - 1] - as_map[module].append(just_imports[index + 1]) + module = just_imports[0] + "." + just_imports[as_index - 1] + as_map[module].append(just_imports[as_index + 1]) else: - module = just_imports[index - 1] - as_map[module].append(just_imports[index + 1]) + module = just_imports[as_index - 1] + as_map[module].append(just_imports[as_index + 1]) if not combine_as_imports: categorized_comments["straight"][module] = comments comments = [] - del just_imports[index : index + 2] + del just_imports[as_index : as_index + 2] if type_of_import == "from": import_from = just_imports.pop(0) placed_module = finder.find(import_from) diff --git a/scripts/clean.sh b/scripts/clean.sh index 57bed200..45e5688c 100755 --- a/scripts/clean.sh +++ b/scripts/clean.sh @@ -1,5 +1,5 @@ #!/bin/bash set -euxo pipefail -# poetry run isort --multi-line=3 --trailing-comma --force-grid-wrap=0 --use-parentheses --line-width=100 --recursive isort/ tests/ +poetry run isort --multi-line=3 --trailing-comma --force-grid-wrap=0 --use-parentheses --line-width=100 --recursive isort/ tests/ poetry run black isort/ tests/ -l 100 diff --git a/scripts/mkstdlibs.py b/scripts/mkstdlibs.py index 4a72c75c..a58cc890 100755 --- a/scripts/mkstdlibs.py +++ b/scripts/mkstdlibs.py @@ -2,7 +2,6 @@ from sphinx.ext.intersphinx import fetch_inventory - URL = "https://docs.python.org/{}/objects.inv" PATH = "isort/stdlibs/py{}.py" VERSIONS = [("2", "7"), ("3",)] |
