-
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
Add populate_all
feature
#26
base: main
Are you sure you want to change the base?
Conversation
@@ -112,6 +112,8 @@ Below is the full listing of options:: | |||
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Too generic. --populate-module-dunder-all
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, but... dunder
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I think you mean under
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think dunder is good.
Thanks! I tried this out in a file like: from foo import bar as alpha, beta
And I got an interesting module name. 😄 |
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
|
Thanks. You might also want to test imports with tabs in the code: from alpha import beta<tab>as<tab>gamma |
Looks good. I found one other edge case. Files like the following, get an empty def foo():
bar = 0
|
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 |
@adhikasp do you still plan to work on this? |
This add
--populate-all
optional argument to populate (append if exist or create it)__all__
variables with unused modules found in the code.Closes #16