Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lines after imports bug with triple quotes #1276

Closed
hyeonjames opened this issue Jul 6, 2020 · 2 comments
Closed

lines after imports bug with triple quotes #1276

hyeonjames opened this issue Jul 6, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@hyeonjames
Copy link
Contributor

Hello!

I found that isort creates only one line when it starts with decorator and triple quotes for top level function or class definition.

( I am not sure if it actually follows PEP8 but my PyCharm and flake8 see it as an error )

I am using isort v5.0.3

from module import decorator


@decorator("""
hello
""")
def a():
    pass

I think this code is supposed to have no problem with isort, but when I used isort, it causes the error below:

(base) james@MacBook-Pro-9 playground % isort isort_bug.py --diff --check
ERROR: /Users/james/playground/isort_bug.py Imports are incorrectly sorted and/or formatted.
--- /Users/james/playground/isort_bug.py:before 2020-07-06 18:22:34.970555
+++ /Users/james/playground/isort_bug.py:after  2020-07-06 18:22:44.025902
@@ -1,5 +1,4 @@
 from module import decorator
-
 
 @decorator

Besides, I think it is caused only when it starts with triple quotes

Below codes have no problem

from module import decorator


@decorator("hello")
def a():
    pass
@hyeonjames
Copy link
Contributor Author

I think I can fix it, I am working on it.

hyeonjames added a commit to hyeonjames/isort that referenced this issue Jul 6, 2020
hyeonjames added a commit to hyeonjames/isort that referenced this issue Jul 8, 2020
hyeonjames added a commit to hyeonjames/isort that referenced this issue Jul 8, 2020
hyeonjames added a commit to hyeonjames/isort that referenced this issue Jul 8, 2020
@timothycrosley timothycrosley added the bug Something isn't working label Jul 8, 2020
timothycrosley added a commit that referenced this issue Jul 9, 2020
Issue #1276: Fix a bug that creates only one line after triple quotes
@timothycrosley
Copy link
Member

Thanks for reporting and fixing! Your changes have been deployed with the 5.0.6 release of isort 🚀

Thanks!

~Timothy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants