navigate.model.features.feature_related_functions.convert_feature_list_to_str
- navigate.model.features.feature_related_functions.convert_feature_list_to_str(feature_list: list) → str
Convert a feature list to its string representation.
This function takes a feature list, which is typically used for specifying configuration options, and converts it to its string representation. The resulting string can be useful for saving, displaying, or transmitting feature lists.
Parameters:
- feature_listlist
A valid feature list.
Returns:
- resultstr
The string representation of the feature list.
Notes:
The function recursively processes the input feature list, converting dictionaries, tuples, and lists to their corresponding string representations.
Within the resulting string, dictionaries are represented with keys “name” and “args” (if present), where “name” is the name of the feature function and “args” contains the arguments as a tuple.
Tuples and lists are represented using parentheses and square brackets, respectively.
This function is intended for converting feature lists to a format that can be easily saved to a file, transmitted over a network, or displayed to users.
Example:
Given the following feature list:
``` [
{“name”: func1, “args”: (arg1, arg2)}, {“name”: func2}, [
{“name”: func3, “args”: (arg3),}, {“name”: func4}
]
]
The function would return the string representation:
` "[{'name': 'func1', 'args': ('arg1', 'arg2')}, {'name': 'func2'}, [{'name': 'func3', 'args': ('arg3'),}, {'name': 'func4'}]]" `