-
Notifications
You must be signed in to change notification settings - Fork 25
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
Relative upper-level imports are improperly linked [python] #36
Comments
Ok, I guess there's no support for double dots. Are there more than 2 dots in Python relative imports anywhere? |
Short answer is yes, it's been copied from the working code. One can import from higher-level packages provided that the current package is not the root. This can depend on |
Oh, I misread your question :) No, three dots is not supported. It's like in relative paths in fs: two dots is a parent dir, single dot is current dir. |
Looking at https://github.com/fiatjaf/module-linker/blob/d8e2601/languages/python.js#L62-L80 I'd say it should support two dots, meaning there's a bug somewhere. I've checked that regexps above work well. |
Also, this https://github.com/fiatjaf/module-linker/blob/d8e2601/languages/python.js#L36-L39 condition looks invalid: it's never true, the code checks that the string is both empty and starts with a dot. |
Thank you very much for the effort, @webknjaz. I'm a little embarrassed by that never-true condition, but anyway, I'll try to fix this as soon as possible. |
Consider this code:
Module Linker creates references to:
instead of referring upper-level packages/modules.
However it successfully recognises same-package imports, like:
The text was updated successfully, but these errors were encountered: