Skip to content

Commit 69e73ff

Browse files
committed
Workaround for 'use' syntax
1 parent cfe45e8 commit 69e73ff

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/pals/kinds/mixin/all_element_mixin.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,14 @@ def unpack_element_list_structure(
6161
f"but we got {item!r}"
6262
)
6363
name, fields = list(item.items())[0]
64+
# Allow a shorthand usage: `- use: element_name` in examples.
65+
# If the value is not a dict but the key is 'use', treat it as
66+
# a reference to an existing element name and wrap it in a
67+
# PlaceholderName so downstream code can resolve it.
6468
if not isinstance(fields, dict):
69+
if name == "use" and isinstance(fields, str):
70+
new_list.append(PlaceholderName(fields))
71+
continue
6572
raise TypeError(
6673
f"Value for element key {name!r} must be a dict (the element's properties), "
6774
f"but we got {fields!r}"

0 commit comments

Comments
 (0)