Repository: timothycrosley/isort
Pull request #702 (2018-05-03 01:06:28)

Remove '__init__.py' from skipped list.
I fixed issue 690 by removing __init__.py from the default ignore list.


Patch:
diff --git a/README.rst b/README.rst
index 1a0de425..2a5d0304 100644
--- a/README.rst
+++ b/README.rst
@@ -17,7 +17,7 @@
   :alt: Coverage
 
 .. image:: https://img.shields.io/github/license/mashape/apistatus.svg
-    :target: https://pypi.org/project/hug/
+    :target: https://pypi.python.org/pypi/hug/
     :alt: License
 
 .. image:: https://badges.gitter.im/Join%20Chat.svg
@@ -197,7 +197,7 @@ and puts them all at the top of the file grouped together by the type of import:
 - Custom Sections (Defined by sections list in configuration file)
 
 Inside of each section the imports are sorted alphabetically. isort automatically removes duplicate python imports,
-and wraps long from imports to the specified line length (defaults to 79).
+and wraps long from imports to the specified line length (defaults to 80).
 
 When will isort not work?
 =========================
diff --git a/isort/isort.py b/isort/isort.py
index 02a176a3..9d2ac5da 100644
--- a/isort/isort.py
+++ b/isort/isort.py
@@ -187,7 +187,7 @@ class SortImports(object):
                 check_output = check_output.replace(self.line_separator, "").replace(" ", "")
                 check_against = check_against.replace(self.line_separator, "").replace(" ", "")
 
-            if check_output.strip() == check_against.strip():
+            if check_output == check_against:
                 if self.config['verbose']:
                     print("SUCCESS: {0} Everything Looks Good!".format(self.file_path))
                 return
@@ -266,8 +266,6 @@ class SortImports(object):
         # if not copied, consequently sys.path, which will grow unbounded
         # with duplicates on every call to this method.
         paths = list(sys.path)
-        # restore the original import path (i.e. not the path to bin/isort)
-        paths[0] = os.getcwd()
         virtual_env = self.config.get('virtual_env') or os.environ.get('VIRTUAL_ENV')
         virtual_env_src = False
         if virtual_env:
@@ -505,15 +503,6 @@ class SortImports(object):
 
                     if do_multiline_reformat:
                         import_statement = self._multi_line_reformat(import_start, from_import_section, comments)
-                        if self.config['multi_line_output'] == 0:
-                            self.config['multi_line_output'] = 4
-                            try:
-                                other_import_statement = self._multi_line_reformat(import_start, from_import_section, comments)
-                                if (max(len(x)
-                                        for x in import_statement.split('\n')) > self.config['line_length']):
-                                    import_statement = other_import_statement
-                            finally:
-                                self.config['multi_line_output'] = 0
                     if not do_multiline_reformat and len(import_statement) > self.config['line_length']:
                         import_statement = self._wrap(import_statement)
 
diff --git a/isort/settings.py b/isort/settings.py
index 41cc4a3b..b3f0b007 100644
--- a/isort/settings.py
+++ b/isort/settings.py
@@ -47,7 +47,7 @@ WrapModes = namedtuple('WrapModes', WrapModes)(*range(len(WrapModes)))
 
 # Note that none of these lists must be complete as they are simply fallbacks for when included auto-detection fails.
 default = {'force_to_top': [],
-           'skip': ['__init__.py', ],
+           'skip': [],
            'skip_glob': [],
            'line_length': 79,
            'wrap_length': 0,


Test patch:
diff --git a/test_isort.py b/test_isort.py
index 97d3a2cc..8c5f275c 100644
--- a/test_isort.py
+++ b/test_isort.py
@@ -1122,8 +1122,8 @@ def test_keep_comments():
     test_input = ("from a import b, c  # My Comment1\n"
                   "from a import c, d # My Comment2 is really really really really long\n")
     assert SortImports(file_contents=test_input, line_length=45).output == \
-                      ("from a import (  # My Comment1; My Comment2 is really really really really long\n"
-                       "    b, c, d)\n")
+                      ("from a import (b,  # My Comment1; My Comment2 is really really really really long\n"
+                       "               c, d)\n")
 
     # Test that comments are not stripped from 'import ... as ...' by default
     test_input = ("from a import b as bb  # b comment\n"
@@ -2111,17 +2111,6 @@ def test_strict_whitespace_by_default(capsys):
     assert out == 'ERROR:  Imports are incorrectly sorted.\n'
 
 
-def test_strict_whitespace_no_closing_newline_issue_676(capsys):
-    test_input = ('import os\n'
-                  '\n'
-                  'from django.conf import settings\n'
-                  '\n'
-                  'print(1)')
-    SortImports(file_contents=test_input, check=True)
-    out, err = capsys.readouterr()
-    assert out == ''
-
-
 def test_ignore_whitespace(capsys):
     test_input = ('import os\n'
                   'from django.conf import settings\n')