From 16b854abc9df642d9f3756534dcc2a23c32ff990 Mon Sep 17 00:00:00 2001 From: Christoph Froehlich Date: Fri, 2 Feb 2024 15:46:21 +0000 Subject: [PATCH] Remove walrus operator --- controller_manager/controller_manager/hardware_spawner.py | 3 ++- controller_manager/controller_manager/spawner.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/controller_manager/controller_manager/hardware_spawner.py b/controller_manager/controller_manager/hardware_spawner.py index c95fb6181e..13c004082e 100644 --- a/controller_manager/controller_manager/hardware_spawner.py +++ b/controller_manager/controller_manager/hardware_spawner.py @@ -45,7 +45,8 @@ def first_match(iterable, predicate): def wait_for_value_or(function, node, timeout, default, description): while node.get_clock().now() < timeout: - if result := function(): + result = function() + if result: return result node.get_logger().info( f"Waiting for {description}", throttle_duration_sec=2, skip_first=True diff --git a/controller_manager/controller_manager/spawner.py b/controller_manager/controller_manager/spawner.py index 536162612e..44c31ef001 100644 --- a/controller_manager/controller_manager/spawner.py +++ b/controller_manager/controller_manager/spawner.py @@ -52,7 +52,8 @@ def first_match(iterable, predicate): def wait_for_value_or(function, node, timeout, default, description): while node.get_clock().now() < timeout: - if result := function(): + result = function() + if result: return result node.get_logger().info( f'Waiting for {description}',