-
Notifications
You must be signed in to change notification settings - Fork 82
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
Removing import in __init__.py #169
Comments
We can't have autoflake ignore init.py everywhere, as not everyone follows the same conventions. You have some options here:
|
I have done that, though this is new behavior in 1.7.3. Reverting back to 1.7.0 leaves my import untouched. This seems like a breaking import removal IMO and autoflake shouldn't touch it (it broke my code at the very least, I imagine I'm not alone here) |
Are you saying that |
My bad, should have been more specific. |
Gotcha, thanks for clarifying! Sounds like a regression then, it was definitely not intended. I'll investigate it. |
Hello! def test_end_to_end_dont_remove_unused_imports_when_not_using_flag(self):
with temporary_file(
"""\
from . import fake_bar
from . import fake_foo
fake_foo.fake_function()
""",
) as filename:
process = subprocess.Popen(
AUTOFLAKE_COMMAND
+ [
filename,
],
stdout=subprocess.PIPE,
)
self.assertEqual(
"",
"\n".join(process.communicate()[0].decode().split(os.linesep)[3:]),
) I ran this test on different release labels and I noticed that it passed on |
@urtubia thanks for sharing the reproducer. I see what's going on now. Fix coming soon. |
I have a python package with a structure like:
The contents of
__init__.py
are as follows:Autoflake is removing all contents from
__init__.py
breaking the package install. To fix the issue I'm asking autoflake to ignore__init__.py
The text was updated successfully, but these errors were encountered: