better_launch.toml.substitutions moduleο
- exception better_launch.toml.substitutions.SubstitutionErrorο
Bases:
ValueErrorException type that will be thrown by substitution handlers.
- better_launch.toml.substitutions.apply_substitutions(value: str, substitutions: dict[str, Callable] = None, context: dict[str, Any] = None, *, eval_type: Literal['full', 'literal', 'none'] = 'full') Anyο
Applies substitutions to a string.
Substitution strings are expected to follow the pattern: ${key *args}, where key is a substitution type and *args are additional arguments to the substitution handler.
If no other substitutions are specified, this function will handle the following ones: - ${param β¦} - ${env β¦} - ${eval β¦}
Substitutions other than those above will be looked up in the provided context dict.
Parametersο
- valuestr
A string that may contain substitution tokens.
- substitutionsdict[str, Callable], optional
Custom substitution handlers. If None, defaults to param, env, and eval.
- contextdict[str, Any], optional
A dict containing additional values the substitution may use.
- eval_typeLiteral[βfullβ, βliteralβ, βnoneβ], optional
If and to what extent eval should be allowed. Default is βfullβ.
Returnsο
- str
The input string with all substitution tokens handled.
Raisesο
- ValueError
If the input string contains unbalanced braces or quotes.
- SubstitutionError
If a substitution handler fails.
- better_launch.toml.substitutions.sub_env(key: str, default: Any = <object object>)ο
- better_launch.toml.substitutions.sub_eval(*args, context: dict, eval_type: Literal['full', 'literal', 'none'] = 'full')ο
- better_launch.toml.substitutions.sub_param(full_node_name: str, param: str)ο