launch.conditions package
Submodules
- launch.conditions.evaluate_condition_expression_impl module
- launch.conditions.if_condition module
- launch.conditions.invalid_condition_expression_error module
- launch.conditions.launch_configuration_equals module
- launch.conditions.launch_configuration_not_equals module
- launch.conditions.unless_condition module
Module contents
conditions Module.
- class launch.conditions.IfCondition[source]
Bases:
ConditionEncapsulates an if condition to be evaluated when launching.
This condition takes a string expression that is lexically evaluated as a boolean, but the expression may consist of
launch.Substitutioninstances.See
evaluate_condition_expression()to understand what constitutes a valid condition expression.- __init__(predicate_expression: str | Path | Substitution | Iterable[str | Path | Substitution]) None[source]
- exception launch.conditions.InvalidConditionExpressionError[source]
Bases:
ValueErrorRaised when an expression being evaluated as a condition is invalid.
- class launch.conditions.LaunchConfigurationEquals[source]
Bases:
ConditionCondition on the value of a launch configuration.
This condition takes an optional string expression that is compared with the value of a launch configuration. If the value is equal to the launch configuration value, then this
Conditionevaluates toTrue. The expression may consist oflaunch.Substitutioninstances.If
Noneis provided instead of a string expression, then the condition evaluates toTrueif the launch configuration is not set.Deprecated since version 1.1.0: Replaced by the more universally usable substitutions: ‘EqualsSubstitution’ and ‘NotEqualsSubstitution’
- class launch.conditions.LaunchConfigurationNotEquals[source]
Bases:
LaunchConfigurationEqualsCondition on the value of a launch configuration.
This condition takes an optional string expression that is compared with the value of a launch configuration. If the value is not equal to the launch configuration value, then this
Conditionevaluates toTrue. The expression may consist oflaunch.Substitutioninstances.If
Noneis provided instead of a string expression, then the condition evaluates toTrueif the launch configuration is set.Deprecated since version 1.1.0: Replaced by the more universally usable substitutions: ‘EqualsSubstitution’ and ‘NotEqualsSubstitution’
- class launch.conditions.UnlessCondition[source]
Bases:
IfConditionEncapsulates an if condition to be evaluated when launching.
Exactly the same as
IfConditionexcept it returns true if the condition expression evaluates to false.- __init__(predicate_expression: str | Path | Substitution | Iterable[str | Path | Substitution]) None[source]
- launch.conditions.evaluate_condition_expression(context: LaunchContext, expression: List[Substitution]) bool[source]
Expand an expression and then evaluate it as a condition, returning true or false.
The expanded expression is stripped and has
lower()called on it before being logically evaluated as either true or false. A string will be considered True if it matches ‘true’ or ‘1’. A string will be considered False if it matches ‘false’ or ‘0’. Any other string content (including empty string) will result in an error.- Raises:
InvalidConditionExpressionError