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:
Condition
Encapsulates 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.Substitution
instances.See
evaluate_condition_expression()
to understand what constitutes a valid condition expression.- __init__(predicate_expression: str | Substitution | Iterable[str | Substitution]) None [source]
- exception launch.conditions.InvalidConditionExpressionError[source]
Bases:
ValueError
Raised when an expression being evaluated as a condition is invalid.
- class launch.conditions.LaunchConfigurationEquals[source]
Bases:
Condition
Condition 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
Condition
evaluates toTrue
. The expression may consist oflaunch.Substitution
instances.If
None
is provided instead of a string expression, then the condition evaluates toTrue
if the launch configuration is not set.Deprecated since version 1.1.0: Replaced by the more universally usable substitutions: ‘EqualsSubstitution’ and ‘NotEqualsSubstitution’
- __init__(launch_configuration_name: str, expected_value: str | Substitution | Iterable[str | Substitution] | None) None [source]
- class launch.conditions.LaunchConfigurationNotEquals[source]
Bases:
LaunchConfigurationEquals
Condition 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
Condition
evaluates toTrue
. The expression may consist oflaunch.Substitution
instances.If
None
is provided instead of a string expression, then the condition evaluates toTrue
if the launch configuration is set.Deprecated since version 1.1.0: Replaced by the more universally usable substitutions: ‘EqualsSubstitution’ and ‘NotEqualsSubstitution’
- __init__(launch_configuration_name: str, expected_value: str | Substitution | Iterable[str | Substitution] | None) None [source]
- class launch.conditions.UnlessCondition[source]
Bases:
IfCondition
Encapsulates an if condition to be evaluated when launching.
Exactly the same as
IfCondition
except it returns true if the condition expression evaluates to false.- __init__(predicate_expression: str | Substitution | Iterable[str | 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