Skip to main content
Version: Next

variable_substitutor

File: core/src/utcp/interfaces/variable_substitutor.py

class VariableSubstitutor​

Documentation

Abstract interface for variable substitution implementations.

Defines the contract for variable substitution systems that can replace placeholders in configuration data with actual values from various sources. Implementations handle different variable resolution strategies and source hierarchies.

Methods:​

substitute(self, obj: dict | list | str, config: UtcpClientConfig, variable_namespace: Optional[str]) -> Any

Substitute variables in the given object.

Args

  • obj: Object containing potential variable references to substitute.
  • config: UTCP client configuration containing variable definitions and loaders.
  • variable_namespace: Optional variable namespace.

Returns

Object with all variable references replaced by their values.

Raises

  • UtcpVariableNotFound: If a referenced variable cannot be resolved.
find_required_variables(self, obj: dict | list | str, variable_namespace: Optional[str]) -> List[str]

Find all variable references in the given object.

Args

  • obj: Object to scan for variable references.
  • variable_namespace: Optional variable namespace.

Returns

List of fully-qualified variable names found in the object.