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

Remove ununsed import error #52

Open
trim21 opened this issue May 17, 2019 · 2 comments
Open

Remove ununsed import error #52

trim21 opened this issue May 17, 2019 · 2 comments

Comments

@trim21
Copy link
Contributor

trim21 commented May 17, 2019

I can't describe it well in title, so I just show the example.

try:
    import playhouse.postgres_ext as pw_pext
except ImportError:
    pass

in this case, pw_pext is unused import.

After autoflake --in-place --remove-unused-variables --remove-all-unused-imports $file

try:
    pass
except ImportError:
    pass
@sevdog
Copy link

sevdog commented Nov 22, 2022

To be clear autoflake is replacing "unused imports" with pass statements.

@LiorYardeni
Copy link

Running the autoflake command twice, the first with -remove-all-unused-imports flag and the second with --ignore-pass-statements, got the desired outcome (removed unused imports weren't replaced with "pass").

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants