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

Import lines with a semicolon separator are improperly formatted #176

Closed
superDross opened this issue Jan 18, 2022 · 1 comment · Fixed by #177
Closed

Import lines with a semicolon separator are improperly formatted #176

superDross opened this issue Jan 18, 2022 · 1 comment · Fixed by #177
Labels
bug Something isn't working

Comments

@superDross
Copy link
Contributor

Description

Import lines that also contain a semicolon separator will be incorrectly formatted.

Steps to reproduce

Execute autoimport on this file:

class Person:
    def __init__(self, name, age, gender):
        self.name = name
        self.age = age
        self.gender = gender

    def say_hi(self):
        import pdb;pdb.set_trace()
        return f"Hello, my name is {self.name}"

Will result in this output:

import pdb;pdb.set_trace()
        return f"Hello, my name is {self.name}"

class Person:
    def __init__(self, name, age, gender):
        self.name = name
        self.age = age
        self.gender = gender

    def say_hi(self):

This is because it thinks this is a multiline import statement (due to the () character

Desired behavior

The expected output should be:

import pdb

class Person:
    def __init__(self, name, age, gender):
        self.name = name
        self.age = age
        self.gender = gender

    def say_hi(self):
        pdb.set_trace()
        return f"Hello, my name is {self.name}"

Environment

david ~ 1 $ autoimport --version
           autoimport version: 1.0.0
               python version: 3.8.7 (default, Jan  3 2021, 20:50:30)  [GCC 10.2.0]
                     platform: Linux-5.10.89-1-MANJARO-x86_64-with-glibc2.2.5
@superDross superDross added the bug Something isn't working label Jan 18, 2022
@superDross superDross changed the title Import lines with a semicolon separator are improberly formatted Import lines with a semicolon separator are improperly formatted Jan 23, 2022
@lyz-code
Copy link
Owner

lyz-code commented Jan 24, 2022

Available since 1.0.3, thanks @superDross for your contribution

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

Successfully merging a pull request may close this issue.

2 participants