-
-
Notifications
You must be signed in to change notification settings - Fork 278
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 ImportAlias node as children of Import nodes #912
Conversation
Update dev version Thanks @cdce8p !
Any movement here? Should I link to the accompanying pylint change? |
@msuozzo thanks for this PR and sorry for the delay. I will try to have a look ASAP. |
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 agree, this change should definitely have tests! |
We will also need to check for unintended side effects with |
@msuozzo are you still interested in finishing this PR ? |
Closing this as there no longer seems interest to finish this PR or add tests. |
Steps
Description
Since the name and alias metadata was already available as Import.names, the main addition here is of the location metadata associated with the alias. The intent is to generate line- and column-accurate lint locations in pylint for e.g. unused location.
For situations with compound imports (e.g.
from foo import bar, baz, qux
), addressing lints to a specific unused import instead of at the statement granularity as it is now would be a substantial quality-of-life improvement.The
ImportAlias
node type shadows the_ast.alias
type in the builtin ast module.I've left the
Import.names
field to maintain backwards compatibility but it might be nice to change it to typelist(ImportAlias)
in the next major version.Type of Changes
Related Issue