launch.substitutions.python_expression module
Module for the PythonExpression substitution.
- class launch.substitutions.python_expression.PythonExpression[source]
Bases:
SubstitutionSubstitution that can access contextual local variables.
The expression may contain Substitutions, but must return something that can be converted to a string with str(). It also may contain math symbols and functions.
- __init__(expression: str | Path | Substitution | Iterable[str | Path | Substitution], python_modules: str | Path | Substitution | Iterable[str | Path | Substitution] = ['math']) None[source]
Create a PythonExpression substitution.
- property expression: List[Substitution]
Getter for expression.
- classmethod parse(data: Sequence[str | Path | Substitution | Iterable[str | Path | Substitution]])[source]
Parse PythonExpression substitution.
- perform(context: LaunchContext) str[source]
Perform the substitution by evaluating the expression.
- property python_modules: List[Substitution]
Getter for python modules.