From 6608dbc920fe61b029669fbbbbaed85565a5afe2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Fr=C3=B6hlich?= Date: Fri, 2 Feb 2024 18:14:32 +0100 Subject: [PATCH] [Spawners] Remove walrus operator (#1366) --- 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}',