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

RedBaron confuse relative path to ellipsis in from_imports #213

Open
Aluriak opened this issue Mar 19, 2022 · 0 comments
Open

RedBaron confuse relative path to ellipsis in from_imports #213

Aluriak opened this issue Mar 19, 2022 · 0 comments

Comments

@Aluriak
Copy link

Aluriak commented Mar 19, 2022

Hi !

The following code:

import redbaron
import json
print(json.dumps(redbaron.RedBaron('from ...util import properties').fst(), indent=4))

returns:

[
    {
        "type": "from_import",
        "first_formatting": [
            {
                "type": "space",
                "value": " "
            }
        ],
        "value": [
            {
                "type": "ellipsis",
                "first_formatting": [],
                "second_formatting": []
            },
            {
                "type": "name",
                "value": "util"
            }
        ],
        "second_formatting": [
            {
                "type": "space",
                "value": " "
            }
        ],
        "third_formatting": [
            {
                "type": "space",
                "value": " "
            }
        ],
        "targets": [
            {
                "type": "name_as_name",
                "value": "properties",
                "target": "",
                "first_formatting": [],
                "second_formatting": []
            }
        ]
    }
]

Where we can clearly see the ellipsis being parsed from the from_import line.

To me, this seems to be a misparse.

Note that increasing the dot number will still yield an ellispsis. To get N ellispsis, provide N*3 dots.

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

No branches or pull requests

1 participant