mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 02:59:33 +07:00
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.
17 lines
410 B
Python
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)
|