You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add support for !list and !dict UW YAML tags to convert quoted values, e.g. Jinja2 expressions, into Python list and dict objects. Among other use cases, this may help avoid the use of wildcards in file paths in e.g. fs mode configs, while keeping them DRY.
For example config.yaml
as: !list "[{% for n in range(3) %} a{{ n }},{% endfor %} ]"
bs: !dict "{{ '{' }}{% for n in range(3) %} b{{ n }}: {{ n }},{% endfor %}{{ '}' }}"
cs: !dict "[{% for n in range(3) %} ['c{{ n }}',{{ n }}],{% endfor %} ]"
Recall that, since config realize renders values in key-value configs on their own, this is a realistic view of a potential intermediate state of the config during dereferencing. After implementation of the new tags, these values would then be converted to primitive Python values like
Note that the final values of bs and cs are equivalent, but the list-of-lists representation in the original Jinja2 expression was more concise, due to not having to escape braces.
AC
Implement tags.
Add/update unit tests.
Update documentation.
The text was updated successfully, but these errors were encountered:
Description
Add support for
!list
and!dict
UW YAML tags to convert quoted values, e.g. Jinja2 expressions, into Pythonlist
anddict
objects. Among other use cases, this may help avoid the use of wildcards in file paths in e.g.fs
mode configs, while keeping them DRY.For example
config.yaml
would currently be rendered as
Recall that, since
config realize
renders values in key-value configs on their own, this is a realistic view of a potential intermediate state of the config during dereferencing. After implementation of the new tags, these values would then be converted to primitive Python values likeNote that the final values of
bs
andcs
are equivalent, but the list-of-lists representation in the original Jinja2 expression was more concise, due to not having to escape braces.AC
The text was updated successfully, but these errors were encountered: