navigate.model.features.feature_related_functions.load_dynamic_parameter_functions
- navigate.model.features.feature_related_functions.load_dynamic_parameter_functions(feature_list: list, feature_parameter_setting_path: str) → None
Load dynamic parameter functions into a feature list in place.
Resolve named function arguments using per-feature YAML settings. Each setting maps a parameter name to function names and their importable modules or Python source paths.
- Parameters:
feature_list (list) – Feature dictionaries and nested lists or tuples. Each dictionary uses
namefor the feature class and optionallyargsfor its positional arguments afterselfandmodel. Matching argument names are replaced with loaded functions in the existing dictionaries.feature_parameter_setting_path (str) – Directory containing settings named
<feature class name>.yml. Features without a settings file are left unchanged.
Notes
A configured argument becomes
Nonewhen its name is absent from the parameter’s mapping or its mapped value isNoneor"None". Existing source paths are loaded as modules; other mapped strings are imported as module names. Nested lists and tuples are processed recursively, while"break"and"continue"entries are skipped.Examples
Given a feature class with a dynamic function parameter:
class ExampleFeature: def __init__(self, model, transform): self.transform = transform feature_list = [ {"name": ExampleFeature, "args": ("sqrt",)}, ]
Store the following in
ExampleFeature.ymlin the settings directory:transform: sqrt: math
Loading these settings replaces the string argument with
math.sqrt:load_dynamic_parameter_functions(feature_list, settings_directory) # feature_list[0]["args"] is now (math.sqrt,).