Files
openide/python/testData/optimizeImports/commentsHandling.after.py
Mikhail Golubev 6ee108b175 PY-23125 Optimize imports stacks unbound comments at the end of the import block
Optimize imports now differentiate between "bound" and "unbound" comments
interleaving import statements. The former immediately precede
the import after them without any blank lines between them, while all
the rest are considered the latter, "unbound", comments which are
grouped and inserted after the whole import block. It allows to handle
the comments before the first import more accurately, moving comments
like "# noinspection" as expected, yet leaving licenses, shebangs and
encoding declarations in place if they are separated with a blank line.

Additionally, this is almost identical to the way "isort" utility
handles line comments.
2017-03-17 14:44:29 +03:00

17 lines
410 B
Python

#!/usr/bin/python
# comment for a
import a # trailing comment for normal import
# comment for b
import b
# comment for c, d
import c # trailing comment for c, d
import d
# comment for name1 and name3
# comment for name2
from mod import name1, name2, name3 # trailing comment for name1, name3; trailing comment for name2
# comment for star import
from mod2 import *
print(a, b, c, d, name1, name2, name3)