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

Failing to parse STAR #181

Open
riccardodivirgilio opened this issue Dec 17, 2024 · 0 comments
Open

Failing to parse STAR #181

riccardodivirgilio opened this issue Dec 17, 2024 · 0 comments

Comments

@riccardodivirgilio
Copy link

When using baron in my source code it fails here:

def _recursive_set_path(schema, data, path, value):
    if schema.is_object:
        if isinstance(value, list_types):
            value = first(value)
        if isinstance(value, dict):

            getter = hasattr(value, "getlist") and value.getlist or value.get

            for k, v in schema.items():
                subvalue = getter(k)

                yield from _recursive_set_path(v, data, (*path, k), subvalue)
        else:
            return  # invalid data, pass

I got the following error:

baron.parser.ParsingError: Error, got an unexpected token STAR here:

  27         if isinstance(value, dict):
  28 
  29             getter = hasattr(value, "getlist") and value.getlist or value.get
  30 
  31             for k, v in schema.items():
  32                 subvalue = getter(k)
  33 
  34                 yield from _recursive_set_path(v, data, (*<---- here

The token STAR should be one of those: BACKQUOTE, BINARY, BINARY_RAW_STRING, BINARY_STRING, COMPLEX, ELLIPSIS, FLOAT, FLOAT_EXPONANT, FLOAT_EXPONANT_COMPLEX, HEXA, INT, INTERPOLATED_RAW_STRING, INTERPOLATED_STRING, LAMBDA, LEFT_BRACKET, LEFT_PARENTHESIS, LEFT_SQUARE_BRACKET, LONG, MINUS, NAME, NOT, OCTA, PLUS, RAW_STRING, RIGHT_PARENTHESIS, STRING, TILDE, UNICODE_RAW_STRING, UNICODE_STRING, YIELD

Baron has failed to parse this input. If this is valid python code (and by that I mean that the python binary successfully parse this code without any syntax error) (also consider that baron does not yet parse python 3 code integrally) it would be kind if you can extract a snippet of your code that make Baron fails and open a bug here: https://github.com/PyCQA/baron/issues

Sorry for the inconvenience.
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