Open ncordon opened 5 years ago
HT @smacker and @kuba--
@ncordon isn't that accurate though ?
from .some import relative
Means relative
is in the some
file that is in the same directory as the current file. Whereas with:
from ..some import relative
Means relative
is in the some
file that is in the parent directory of the directory containing the current file. So it makes sense that the first would have one ..
node, and the second two ?
All single dots are returned as double dots right now but splitting happens correctly. As a workaround, you can just post-process bblfsh results by replacing ..
with .
to get the right relative path. (at least it worked for all cases I had):
Yeah I did the same, and I'd say the double dot makes more sense to me then a single one, as if you were in the file and wanted to go to the import, you would move around doing cd ../../some
etc.
Currently, for
from .some import relative
, we get a node with..
:And for
from ..some import relative
, we get two nodes with..
:It may be related to this line