We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
eg I expect the following to generate '{"ham": "spam", **({"x": x} if x else {})}'
'{"ham": "spam", **({"x": x} if x else {})}'
from libcst import ( Dict, DictElement, SimpleString, Name, LeftParen, RightParen, StarredDictElement, IfExp, Module, parse_expression, ) d = Module( [ Dict( elements=[ DictElement( key=SimpleString(value='"ham"'), value=SimpleString(value='"spam"') ), StarredDictElement( value=IfExp( test=Name(value="x"), body=Dict( elements=[ DictElement( key=SimpleString(value='"x"'), value=Name(value="x") ) ] ), orelse=Dict(elements=[]), ) ), ] ) ] ) parse_expression(d.code) # SyntaxError assert d.code == '{"ham": "spam", **({"x": x} if x else {})}'
however I get '{"ham": "spam", **{"x": x} if x else {}}'
'{"ham": "spam", **{"x": x} if x else {}}'
The text was updated successfully, but these errors were encountered:
I need to add an additional lpar=[LeftParen()], rpar=[RightParen()]:
lpar=[LeftParen()], rpar=[RightParen()]
Dict( elements=[ DictElement( key=SimpleString(value='"ham"'), value=SimpleString(value='"spam"') ), StarredDictElement( value=IfExp( test=Name(value="x"), body=Dict( elements=[ DictElement( key=SimpleString(value='"x"'), value=Name(value="x") ) ] ), orelse=Dict(elements=[]), lpar=[LeftParen()], rpar=[RightParen()], ) ), ] )
Sorry, something went wrong.
I have the same problem with all of cst.IfExp, cst.BooleanOperation, cst.BinaryOperation, but I'm sure there's more
cst.IfExp, cst.BooleanOperation, cst.BinaryOperation
No branches or pull requests
eg I expect the following to generate
'{"ham": "spam", **({"x": x} if x else {})}'
however I get
'{"ham": "spam", **{"x": x} if x else {}}'
The text was updated successfully, but these errors were encountered: