-
Notifications
You must be signed in to change notification settings - Fork 300
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
codeintel2: Python: Fixes relative imports #14
Conversation
Relative improts where always based on the main buffer's path. Instead, use current relative path (if there is one) for relative imports. Fixes the case where a module `module.first` imports `module.first.some` by using relative import `import .some` and the current buffer's path is not in `module/first`.
@Kronuz, any chance you could elaborate on this PR? |
It is not true. «from ...xxx import yyy» syntax works for Python 2 and Python 3, and even supported by pylint checker. |
I never said |
Yes, «import .whatever» is invalid, but I was asked to comment «in Python it is illegal to use a relative import to refer to modules located in a different directory on the filesystem» |
Yes, that's fair. When taken out of this PR's context, the sentence you quoted can be false under most interpretations. |
Closing this, as we cannot commit it without a proper test case, and there has been no response for over a year and a half. |
Relative improts where always based on the main buffer's path.
Instead, use current relative path (if there is one) for relative
imports.
Fixes the case where a module
module.first
importsmodule.first.some
by using relative import
import .some
and the current buffer's pathis not in
module/first
.