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

Broken syntax with multiline, function-local imports #250

Open
hydrargyrum opened this issue Oct 3, 2023 · 3 comments
Open

Broken syntax with multiline, function-local imports #250

hydrargyrum opened this issue Oct 3, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@hydrargyrum
Copy link
Contributor

hydrargyrum commented Oct 3, 2023

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.

@hydrargyrum hydrargyrum added the bug Something isn't working label Oct 3, 2023
@lyz-code
Copy link
Owner

lyz-code commented Oct 3, 2023

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?

@hydrargyrum
Copy link
Contributor Author

hydrargyrum commented Oct 3, 2023

Ok, I'll try but I can't promise yet I'll understand how to do it!

@lyz-code
Copy link
Owner

lyz-code commented Oct 4, 2023

Lovely <3, if you have any question I'd do my best to answer them

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