diplomat.processing.ProgressBar

class diplomat.processing.ProgressBar(total: int | None = None)[source]

Bases: ABC

Abstract API for representing a progress bar. Used by predictors for displaying progress info.

abstractmethod __init__(total: int | None = None)[source]

Create a new progress bar.

Parameters:

total – An optional integer, the total number of steps that need to be completed. If set to None progress bar disables completion percentage features and simply keeps track of the number of iterations done.

Methods

__init__([total])

Create a new progress bar.

close()

Close the progress bar, disabling any additional updates.

message(message)

Set the description message for the progress bar.

reset([total])

Reset the progress bar with a new total value to reach.

update([amt])

Perform a progress bar update, increasing the number of iterations done.

abstractmethod close()[source]

Close the progress bar, disabling any additional updates.

abstractmethod message(message: str)[source]

Set the description message for the progress bar.

Parameters:

message – A string, the message to include with or above the progress bar. Can be used to describe the current state a process is in.

abstractmethod reset(total: int | None = None)[source]

Reset the progress bar with a new total value to reach.

Parameters:

total – An optional integer, the total number of steps that need to be completed. If set to None progress bar disables completion percentage features and simply keeps track of the number of iterations done.

abstractmethod update(amt: int = 1)[source]

Perform a progress bar update, increasing the number of iterations done.

Parameters:

amt – The number of iterations or steps done, to increase the progress bar by. Defaults to 1.