Skip to content
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

Show hopefully friendlier messages #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ericbn
Copy link

@ericbn ericbn commented Mar 27, 2022

Since relative imports don't work with the import <> syntax, suggest importing the names directly. In these cases, the i.module is None and the i.level has the number of levels down in the relative import, e.g. 1 means the current directory.

If there's only one name, suggest:

use 'import module.name' instead of 'from module import name'

This implements the enhancement proposed in #1.

Since relative imports don't work with the `import <>` syntax, suggest
importing the names directly. In these cases, the `i.module` is `None`
and the `i.level` has the number of levels down in the relative import,
e.g. `1` means the current directory.

If there's only one name, suggest:

    use 'import module.name' instead of 'from module import name'

This implements the enhancement proposed in sfstpala#1.
@ericbn
Copy link
Author

ericbn commented Mar 27, 2022

Tested with success in all of "py27,py34,py35,py36".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant