Skip to content

Commit

Permalink
Remove walrus operator
Browse files Browse the repository at this point in the history
  • Loading branch information
christophfroehlich committed Feb 2, 2024
1 parent 4409e77 commit 16b854a
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 16b854a

Please sign in to comment.