autoflake
autoflake copied to clipboard
Remove ununsed import error
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
To be clear autoflake is replacing "unused imports" with pass statements.
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").