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
Add option to keep the useless passes #9
Conversation
There seem to be test failures that result from this change. |
I don't think this change works in general. For example, in the case of $ ./autoflake.py /opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/codecs.py
--- original//opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/codecs.py
+++ fixed//opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/codecs.py
@@ -393,7 +393,6 @@
stream to recover state.
"""
- pass
def seek(self, offset, whence=0):
self.stream.seek(offset, whence)
@@ -1098,7 +1097,6 @@
# package
_false = 0
if _false:
- import encodings
### Tests |
Ah. Thanks. I figured there was a reason behind replacing the import with a pass I'll take a second shot at it shortly. |
Can this be fixed up? |
I have the last version and it is still removing the |
I tried this branch with
and it works as it's expected: leaving the I would like to have this merged into master. |
@humitos, I think the problem mentioned in #9 (comment) would need to be resolved first. |
@myint I think it's already fixed: $ autoflake /usr/lib/python3.5/codecs.py
--- original//usr/lib/python3.5/codecs.py
+++ fixed//usr/lib/python3.5/codecs.py
@@ -393,7 +393,6 @@
stream to recover state.
"""
- pass
def seek(self, offset, whence=0):
self.stream.seek(offset, whence) Using the option added in that PR:
|
@humitos, I still get the original error. I've put my
--- original//opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/codecs.py
+++ fixed//opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/codecs.py
@@ -393,7 +393,6 @@
stream to recover state.
"""
- pass
def seek(self, offset, whence=0):
self.stream.seek(offset, whence)
@@ -1098,7 +1097,6 @@
# package
_false = 0
if _false:
- import encodings
### Tests |
And I can find many more similar errors by running the acid test for about a minute.
|
@alvarotroya do you have any interest in porting your changes in fsouza/autoflake8#70? If not, I can do it. |
Hi @fsouza, thank you for the ping! I can definitely do it, if I remember correctly I already did this on a local branch but was missing the tests. I’ll take care of this and start a PR. |
PR started here: #143 |
Adds a
--keep-useless-pass
argument to the CLI.Also had to change the behavior that replaces a removed import with
pass
to return None instead and filter out Nones