Skip to content
This repository was archived by the owner on Mar 8, 2020. It is now read-only.
This repository was archived by the owner on Mar 8, 2020. It is now read-only.

Prepending .. in relative imports #213

Description

@ncordon

Currently, for from .some import relative, we get a node with ..:

relative

And for from ..some import relative, we get two nodes with ..:

relativex2

It may be related to this line

Activity

  1. ncordon commented on Sep 10, 2019

    @ncordon
    MemberAuthor
  2. r0mainK commented on Sep 27, 2019

    @r0mainK

    @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 ?

  3. smacker commented on Sep 27, 2019

    @smacker
    Contributor

    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):

    Screenshot 2019-09-27 at 12 02 52

  4. r0mainK commented on Sep 27, 2019

    @r0mainK

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions