parse_feature_expression
Note
This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the Habitat Guide and Python API guide (v2.0) for usage.
- parse_feature_expression(expression: str) Spec[source]
Parse one feature-tree expression into its canonical Spec tree.
This is the strict v1 spelling: quoted modality names, explicit
key=valueparameters, nested calls for combiner children. The v0 bare-token mini-language is handled by the legacy config adapter instead; this parser deliberately rejects it so ambiguous expressions fail loudly rather than silently guessing.- Parameters:
expression – The expression, e.g.
'concat(raw("T1"), ratio(raw("T1"), raw("T2"), as_="r"))'.- Returns:
The root node’s Spec; combiner children nest under
params['children']asSpec.to_dict()payloads.- Raises:
HABITAPIError – On any malformed or ambiguous input.