Skip to content

Commit

Permalink
[Spawners] Remove walrus operator (#1366)
Browse files Browse the repository at this point in the history
  • Loading branch information
christophfroehlich authored Feb 2, 2024
1 parent 4409e77 commit 6608dbc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion controller_manager/controller_manager/hardware_spawner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion controller_manager/controller_manager/spawner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}',
Expand Down

0 comments on commit 6608dbc

Please sign in to comment.