Merge branch 'release/3.3.1'
diff --git a/README.md b/README.md
index ddffc23..8ed7f10 100644
--- a/README.md
+++ b/README.md
@@ -380,6 +380,12 @@
SUCCESS: /home/timothy/Projects/Open_Source/isort/isort_kate_plugin.py Everything Looks Good! (stdout)
ERROR: /home/timothy/Projects/Open_Source/isort/isort/isort.py Imports are incorrectly sorted. (stderr)
+
+One great place this can be used is with a pre-commit git hook, such as this one by @acdha:
+
+https://gist.github.com/acdha/8717683
+
+Which can help to ensure a certain level of code quality throughout a project.
Why isort?
======================
diff --git a/isort/__init__.py b/isort/__init__.py
index 3736996..ccd31e5 100644
--- a/isort/__init__.py
+++ b/isort/__init__.py
@@ -25,4 +25,4 @@
from . import settings
from .isort import SECTION_NAMES, SECTIONS, SortImports
-__version__ = "3.3.0"
+__version__ = "3.3.1"
diff --git a/isort/isort.py b/isort/isort.py
index 6489bb2..4d1ff56 100644
--- a/isort/isort.py
+++ b/isort/isort.py
@@ -447,6 +447,11 @@
line = self._strip_comments(self._get_line())
import_string += "\n" + line
+ if import_type == "from":
+ parts = import_string.split(" import ")
+ from_import = parts[0].split(" ")
+ import_string = " import ".join([from_import[0] + " " + "".join(from_import[1:])] + parts[1:])
+
import_string = import_string.replace("_import", "[[i]]")
for remove_syntax in ['\\', '(', ')', ",", 'from ', 'import ']:
import_string = import_string.replace(remove_syntax, " ")
diff --git a/setup.py b/setup.py
index f6f081f..c847dcb 100755
--- a/setup.py
+++ b/setup.py
@@ -42,13 +42,13 @@
readme = ''
setup(name='isort',
- version='3.3.0',
+ version='3.3.1',
description='A Python utility / library to sort Python imports.',
long_description=readme,
author='Timothy Crosley',
author_email='timothy.crosley@gmail.com',
url='https://github.com/timothycrosley/isort',
- download_url='https://github.com/timothycrosley/isort/archive/3.3.0.tar.gz',
+ download_url='https://github.com/timothycrosley/isort/archive/3.3.1.tar.gz',
license="MIT",
entry_points={
'console_scripts': [
diff --git a/test_isort.py b/test_isort.py
index 22d8761..a7fc6dc 100644
--- a/test_isort.py
+++ b/test_isort.py
@@ -602,3 +602,9 @@
test_output = SortImports(file_contents=test_input, line_length=70, balanced_wrapping=True).output
assert test_output == ("from __future__ import (absolute_import, division,\n"
" print_function, unicode_literals)\n")
+
+
+def test_relative_import_with_space():
+ """Tests balanced wrapping mode, where the length of individual lines maintain width."""
+ test_input = ("from ... fields.sproqet import SproqetCollection")
+ assert SortImports(file_contents=test_input).output == ("from ...fields.sproqet import SproqetCollection\n")