pulumi/pkg/codegen/internal/test/testdata
Pat Gavlin 1d6cce98fe
[codegen/python] Fix nested quotes. (#4539)
Unlike most languages with interpolated strings, Python's formatted
string literals do not allow the nesting of quotes. For example,
this expression is not legal Python:

    f"Foo {"bar"} baz"

If an interpolation requires quotes, those quotes nust differ from the
quotes used by the enclosing literal. We can fix the previous example
by rewriting it with single quotes:

    f"Foo {'bar'} baz"

However, this presents a problem if there are more than two levels of
nesting, as Python only has two kinds of quotes (four if the outermost
string uses """ or '''): in this case, the expression becomes
unspellable, and must be assigned to a local that is then used in place
of the original expression. So this:

    f"Foo {bar[f'index {baz["qux"]}']} zed"

becomes this:

    index = "qux"
    f"Foo {bar[f'index {baz[index]}']}"

To put it bluntly, Python code generation reqiures register allocation,
but for quotes. These changes implement exactly that.

These changes also include a fix for traversals that access values that
are dictionaries rather than objects, and must use indexers rather than
attributes.
2020-04-30 16:34:25 -07:00
..
aws-fargate.pp Fix Python input property names. 2020-04-21 13:55:33 -07:00
aws-fargate.pp.py [codegen/python] Fix case mapping. (#4538) 2020-04-30 14:16:56 -07:00
aws-fargate.pp.ts Fix Python input property names. 2020-04-21 13:55:33 -07:00
aws-s3-folder.pp HCL2 updates (#4309) 2020-04-06 19:43:16 -07:00
aws-s3-folder.pp.py [codegen/python] Fix nested quotes. (#4539) 2020-04-30 16:34:25 -07:00
aws-s3-folder.pp.ts Codegen: collect imports from function calls. (#4445) 2020-04-21 10:24:42 -07:00
aws-s3-logging.pp Fix output property names in Python codegen. 2020-04-21 10:25:27 -07:00
aws-s3-logging.pp.py [codegen/python] Fix nested quotes. (#4539) 2020-04-30 16:34:25 -07:00
aws-s3-logging.pp.ts Fix output property names in Python codegen. 2020-04-21 10:25:27 -07:00
aws-webserver.pp HCL2 updates (#4309) 2020-04-06 19:43:16 -07:00
aws-webserver.pp.py [codegen/python] Fix case mapping. (#4538) 2020-04-30 14:16:56 -07:00
aws-webserver.pp.ts HCL2/NodeJS: fix proxy apply lowering for promises (#4317) 2020-04-07 09:25:50 -07:00
aws.json HCL2 updates (#4309) 2020-04-06 19:43:16 -07:00