Skip to content

Commit

Permalink
Get rid of unnecessary checks in composable_node_container. (#364)
Browse files Browse the repository at this point in the history
valid_composable_nodes is a local variable that we know
is a list.  So we can just do the idiomatic Python thing
and check with a simple "if" statement.  This is also
faster.

Signed-off-by: Chris Lalancette <[email protected]>
  • Loading branch information
clalancette authored Jun 13, 2023
1 parent d2a7128 commit 02b3836
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions launch_ros/launch_ros/actions/composable_node_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,7 @@ def execute(self, context: LaunchContext) -> Optional[List[Action]]:
if node_object.condition() is None or node_object.condition().evaluate(context):
valid_composable_nodes.append(node_object)

if (
valid_composable_nodes is not None and
len(valid_composable_nodes) > 0
):
if valid_composable_nodes:
from .load_composable_nodes import LoadComposableNodes
# Perform load action once the container has started.
load_actions = [
Expand Down

0 comments on commit 02b3836

Please sign in to comment.