You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from autoflake import fix_code
def fix_code():
return "this"
print(fix_code())
import from autoflake import fix_code won't be removed. I found this issue while using pymerger and merging multiple files into a single one. For some reason, pymerger is failing in not including imports that should actually not be included, and instead they are included in the file single file (see yamenk-gribaudo/pymerger#2).
So, if you run autoflake on the file to remove unused imports on symbol redefinition, as shown in the snippet above, it won't succeed in remove those imports.
In the example above fix_code from autoflake is not used in the file. What's being used is fix_code defined in the file instead by inner scoping.
The text was updated successfully, but these errors were encountered:
gentunian
changed the title
not removing imports when a symbol is redeclared or has the same name
not removing imports when a symbol is redeclared
Feb 24, 2025
Consider the following example:
import
from autoflake import fix_code
won't be removed. I found this issue while usingpymerger
and merging multiple files into a single one. For some reason,pymerger
is failing in not including imports that should actually not be included, and instead they are included in the file single file (see yamenk-gribaudo/pymerger#2).So, if you run
autoflake
on the file to remove unused imports on symbol redefinition, as shown in the snippet above, it won't succeed in remove those imports.In the example above
fix_code
fromautoflake
is not used in the file. What's being used isfix_code
defined in the file instead by inner scoping.The text was updated successfully, but these errors were encountered: