autoimport
autoimport copied to clipboard
Broken syntax with multiline, function-local imports
Description
Steps to reproduce
Input file:
from foo import bar
class C(bar.C):
def method(self, param):
from foo.some_very_long_name_of_a_module.another_submodule.wait_for_it import (
yet_another_long_name
)
yet_another_long_name(param)
Run autoimport on that file.
Current behavior
Output file:
from foo import bar
from foo.some_very_long_name_of_a_module.another_submodule.wait_for_it import (
yet_another_long_name
)
class C(bar.C):
def method(self, param):
yet_another_long_name(param)
Desired behavior
Syntax is not broken. Import moved correctly (or not moved, see #249)
Environment
autoimport 1.3.3
By the way, neither make version nor python -c "import autoimport.version; print(autoimport.version.version_info())" do work with pipx, I used pipx list, which is a bit rigid.
Hi @hydrargyrum thanks for taking the time to open another issue. I can reproduce the issue, will you be able to submit a PR to fix it?
Ok, I'll try but I can't promise yet I'll understand how to do it!
Lovely <3, if you have any question I'd do my best to answer them