Open
Conversation
jayvdb
requested changes
Aug 29, 2017
| this only triggers if there is only one star import in | ||
| the file; this is skipped if there are any uses of | ||
| `__all__` or `del` in the file | ||
| --populate-all populate `__all__` with unused import found in the |
Member
There was a problem hiding this comment.
Too generic. --populate-module-dunder-all ?
Contributor
Author
There was a problem hiding this comment.
Yeah, but... dunder?
Contributor
Author
There was a problem hiding this comment.
Oh I think you mean under
Member
|
Thanks! I tried this out in a file like: from foo import bar as alpha, betaAnd I got an interesting module name. 😄 |
Contributor
Author
|
Weird, i test `as` too yesterday and it works :/
Will look into it.
On Thu, 31 Aug 2017, 09:07 Steven Myint ***@***.***> wrote:
Thanks!
I tried this out in a file like:
from foo import bar as alpha, beta
$ ./autoflake.py --pop __init__.py
--- original/__init__.py
+++ fixed/__init__.py
@@ -1 +1,2 @@
from foo import bar as alpha, beta
+__all__ = ['bar as alpha', 'beta']
And I got an interesting module name. 😄
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#26 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AF3chnXUcDjN1Hr7UeREnsgyrhOBzHWqks5sdhVJgaJpZM4PFTU5>
.
--
Regards
Adhika Setya Pramudita
Undergraduate student of Information Technology
University of Gadjah Mada Yogyakarta
Web: http://adhikasetyap.me
LinkedIn http://id.linkedin.com/in/adhikasp
|
Member
|
Thanks. You might also want to test imports with tabs in the code: from alpha import beta<tab>as<tab>gamma |
Member
|
Looks good. I found one other edge case. Files like the following, get an empty def foo():
bar = 0 |
Member
|
I guess the other thing I notice from the above is that this new feature affects all files. I think we should be conservative and only touch |
Collaborator
|
@adhikasp do you still plan to work on this? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This add
--populate-alloptional argument to populate (append if exist or create it)__all__variables with unused modules found in the code.Closes #16