-
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
Prevent from * import *
to be splitted
#15
Conversation
Cool! I'll take a closer look later this week. |
I committed a relevant test case in 71fa850. Could you try that? Also, could you add the following test case? from frommer import abc, frommer, xyz Currently, with this pull requests, I get the following error from the above.
Thanks |
Ok will do it 👍 |
fa06eb7
to
6ac31f1
Compare
Updated:
|
How about: from collections import defaultdict, namedtuple as xyz It seems to currently give:
|
6ac31f1
to
885a427
Compare
One thing that still buggy is if the input have irregular spacing (more than 1) will not removed because i directly compare them with output from from a import b as c Do you think we should handle that too? |
Great work! I think leaving irregular spacing untouched is fine. I have one thing I want to confirm. Is this new feature meant for top-level imports only? I noticed: --- original/foo.py
+++ fixed/foo.py
@@ -1,3 +1,4 @@
def z():
- from ctypes import c_short, c_uint, c_int, c_long, pointer, POINTER, byref
+ from ctypes import POINTER
+ from ctypes import byref
POINTER, byref It seems to use the old behavior for indented cases. This is fine if intended. But I just wanted to check. Thanks |
885a427
to
23dd99f
Compare
Oh no, I did not mean that. The behaviour of top-level import and inside function should be same right? I made change to support non-top level import and the related test. |
Thanks for sticking with this! I'm running fuzz tests against this right now. Once it runs okay for a bit longer, I'll merge it. |
Interesting! Somehow I committed to your repository. I was intending to continue committing to my branch. But instead, my latest commits ended up in your repository's branch of the same name. Maybe GitHub grants permission to the repository owner to modify pull request branches from the repository fork. |
This will prevent a
from something import a, b, c
to be splitted.Test code
Result
Closes #7