launch.substitutions.boolean_substitution module

Module for boolean substitutions.

class launch.substitutions.boolean_substitution.AllSubstitution[source]

Bases: ContainerSubstitution

Substitutes to the string ‘true’ if all the input arguments evaluate to true.

If any of the arguments evaluates to false, then this substitution returns the string ‘false’.

The following string arguments evaluate to true: ‘1’, ‘true’, ‘True’, ‘on’ The following string arguments evaluate to false: ‘0’, ‘false’, ‘False’, ‘off’

__init__(*args: str | Path | Substitution | Iterable[str | Path | Substitution], container: Iterable[str | Path | Substitution | Iterable[str | Path | Substitution]] | None = None) None[source]

Create an AllSubstitution substitution.

class launch.substitutions.boolean_substitution.AndSubstitution[source]

Bases: LeftRightLogicalSubstitution

Substitution that returns ‘and’ of the input boolean values.

__init__(left: str | Path | Substitution | Iterable[str | Path | Substitution], right: str | Path | Substitution | Iterable[str | Path | Substitution]) None[source]

Create an AndSubstitution substitution.

class launch.substitutions.boolean_substitution.AnySubstitution[source]

Bases: ContainerSubstitution

Substitutes to the string ‘true’ if at least one of the input arguments evaluates to true.

If none of the arguments evaluate to true, then this substitution returns the string ‘false’.

The following string arguments evaluate to true: ‘1’, ‘true’, ‘True’, ‘on’ The following string arguments evaluate to false: ‘0’, ‘false’, ‘False’, ‘off’

__init__(*args: str | Path | Substitution | Iterable[str | Path | Substitution], container: Iterable[str | Path | Substitution | Iterable[str | Path | Substitution]] | None = None) None[source]

Create an AnySubstitution substitution.

class launch.substitutions.boolean_substitution.ContainerSubstitution[source]

Bases: Substitution

Substitution running a logical evaluation on the boolean values of the container.

__init__(func: Callable[[Iterable[str | Path | Substitution | Iterable[str | Path | Substitution] | int | float | bool | Sequence[int | str] | Sequence[float | str] | Sequence[bool | str] | Sequence[str]]], bool], *args: str | Path | Substitution | Iterable[str | Path | Substitution], container: Iterable[str | Path | Substitution | Iterable[str | Path | Substitution]] | None = None) None[source]

Create a ContainerSubstitution substitution.

The following string arguments evaluate to true: ‘1’, ‘true’, ‘True’, ‘on’ The following string arguments evaluate to false: ‘0’, ‘false’, ‘False’, ‘off’

property args: List[List[Substitution]]

Getter for args.

describe() str[source]

Return a description of this substitution as a string.

property func: Callable[[List[str | Path | Substitution | Iterable[str | Path | Substitution] | int | float | bool | Sequence[int | str] | Sequence[float | str] | Sequence[bool | str] | Sequence[str]]], bool]

Getter for the logical evaluation function.

classmethod parse(data: Iterable[str | Path | Substitution | Iterable[str | Path | Substitution]]) Tuple[Type[ContainerSubstitution], Dict[str, Any]][source]

Parse ContainerSubstitution substitution.

perform(context: LaunchContext) str[source]

Perform the substitution.

class launch.substitutions.boolean_substitution.LeftRightLogicalSubstitution[source]

Bases: Substitution

Substitution that returns the result of logical evaluation of the input boolean values.

__init__(func: Callable[[str | Path | Substitution | Iterable[str | Path | Substitution] | int | float | bool | Sequence[int | str] | Sequence[float | str] | Sequence[bool | str] | Sequence[str], str | Path | Substitution | Iterable[str | Path | Substitution] | int | float | bool | Sequence[int | str] | Sequence[float | str] | Sequence[bool | str] | Sequence[str]], bool], left: str | Path | Substitution | Iterable[str | Path | Substitution], right: str | Path | Substitution | Iterable[str | Path | Substitution]) None[source]

Create an LeftRightLogicalSubstitution substitution.

describe() str[source]

Return a description of this substitution as a string.

property func: Callable[[str | Path | Substitution | Iterable[str | Path | Substitution] | int | float | bool | Sequence[int | str] | Sequence[float | str] | Sequence[bool | str] | Sequence[str], str | Path | Substitution | Iterable[str | Path | Substitution] | int | float | bool | Sequence[int | str] | Sequence[float | str] | Sequence[bool | str] | Sequence[str]], bool]

Getter for the logical evaluation function.

property left: List[Substitution]

Getter for left.

classmethod parse(data: Sequence[str | Path | Substitution | Iterable[str | Path | Substitution]]) Tuple[Type[LeftRightLogicalSubstitution], Dict[str, Any]][source]

Parse LeftRightLogicalSubstitution substitution.

perform(context: LaunchContext) str[source]

Perform the substitution.

property right: List[Substitution]

Getter for right.

class launch.substitutions.boolean_substitution.NotSubstitution[source]

Bases: Substitution

Substitution that returns ‘not’ of the input boolean value.

__init__(value: str | Path | Substitution | Iterable[str | Path | Substitution]) None[source]

Create a NotSubstitution substitution.

describe() str[source]

Return a description of this substitution as a string.

classmethod parse(data: Sequence[str | Path | Substitution | Iterable[str | Path | Substitution]]) Tuple[Type[NotSubstitution], Dict[str, Any]][source]

Parse NotSubstitution substitution.

perform(context: LaunchContext) str[source]

Perform the substitution.

property value: List[Substitution]

Getter for value.

class launch.substitutions.boolean_substitution.OrSubstitution[source]

Bases: LeftRightLogicalSubstitution

Substitution that returns ‘or’ of the input boolean values.

__init__(left: str | Path | Substitution | Iterable[str | Path | Substitution], right: str | Path | Substitution | Iterable[str | Path | Substitution]) None[source]

Create an OrSubstitution substitution.