Skip to content

Added --surround-invalid-expressions-with-single-quotes#315

Open
leanderbuerkin wants to merge 1 commit into
pybind:mainfrom
leanderbuerkin:main
Open

Added --surround-invalid-expressions-with-single-quotes#315
leanderbuerkin wants to merge 1 commit into
pybind:mainfrom
leanderbuerkin:main

Conversation

@leanderbuerkin

Copy link
Copy Markdown

Hellau,

Thanks for this nice repository to create stubs!

I had an issue: Using '--print-invalid-expressions-as-is' I could not use ast.parse() to postprocess these invalid expression. If Not setting this flag replaces them with ellipses - so also not good.

My suggestion is, to surround the invalid expressions found in type annotations with single quotes.
This way they are represented as ast.Constant() by ast.parse().

I did test it on my own project creating stub files for casadi and it worked flawlessly.

I did not write any tests since I wanted your feedback first. E.g. if Printer.invalid_expr_as_ellipses should be removed, since there is a better option or if surrounding by quotes should even become the default from now on.

Greetings
Leander

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

Successfully merging this pull request may close these issues.

1 participant