@@ -334,7 +334,7 @@ def increment_progress(self, amount: int):
334334 DeprecationWarning ,
335335 stacklevel = 2 ,
336336 )
337- return self .increment_value (amount )
337+ self .increment_value (amount )
338338
339339 def increment_value (self , amount : int ):
340340 """Increment the task progress by adding the specified amount to the current value.
@@ -353,14 +353,17 @@ def update_progress(self, value: int, value_step: int = None, rate_limit: int =
353353 )
354354 self .update_value (value , value_step , rate_limit )
355355
356- def update_value (self , value : int , value_step : int = None , rate_limit : int = None ):
356+ def update_value (self , value : int , value_step : int = None , rate_limit : int = None ) -> bool :
357357 """Update task progress.
358358
359359 Arguments:
360360 value: The new value to set.
361361 value_step: The minimum change in value required to trigger an update.
362362 rate_limit: The minimum interval between updates in seconds.
363363
364+ Returns:
365+ bool: True if the task was updated, False otherwise
366+
364367 If either `value_step` or `rate_limit` is set, the task will only be updated if the
365368 specified conditions are met. If both are set, the task will be updated if either
366369 condition is met.
@@ -370,6 +373,8 @@ def update_value(self, value: int, value_step: int = None, rate_limit: int = Non
370373 value_check = value_step and self ._check_update_value_interval (value , value_step )
371374 if skip_check or time_check or value_check :
372375 self .update (value = value )
376+ return True
377+ return False
373378
374379 def set_value_max (self , value_max : int ):
375380 """Set the `value_max`."""
@@ -424,16 +429,21 @@ def tag(self, tags: dict[str, str]):
424429 """Add tags to the task."""
425430 self .update (tags = tags )
426431
427- def ping (self , rate_limit = None ):
432+ def ping (self , rate_limit = None ) -> bool :
428433 """Update the task without changing any values. This can be used in conjunction
429434 with 'stale_timeout' to indicate that the task is still running.
430435
431436 Arguments:
432437 rate_limit: The minimum interval between pings in seconds. If set this will only
433438 update the task if the last update was more than `rate_limit` seconds ago.
439+
440+ Returns:
441+ bool: True if the task was updated, False otherwise
434442 """
435443 if self ._check_update_time_interval (rate_limit ):
436444 self .update ()
445+ return True
446+ return False
437447
438448 @property
439449 def tags (self ):
0 commit comments