mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-05 04:40:28 +07:00
relative imports should be inserted instead of absolute ones when possible (PY-6054)
If the file already has relative imports, next one inserted via completion/auto-import has a chance to be relative. For that new import has to have the number of dots <= than the max of the file's relative import and a number provided by a registry value in 'python.relative.import.depth', that is 3 by default. It also has to be located in the same root package, since python doesn't allow relative imports to step outside of it. The file must not have "if __name__ == '__main__'" in it, since it suggests that it is intended to be runnable and relative imports will not work. Relative import statements can also be updated with new import elements, if the user's codestyle allows it. GitOrigin-RevId: 766a03e2252bb1f8193a2156831cc8fdf0a7aced
This commit is contained in:
committed by
intellij-monorepo-bot
parent
1d13116e16
commit
2d72c69170
@@ -0,0 +1,2 @@
|
||||
from ....foo import foo_func
|
||||
from ....bar import bar_func
|
||||
@@ -0,0 +1 @@
|
||||
from ....bar import bar_func
|
||||
Reference in New Issue
Block a user