@@ -192,9 +192,20 @@ def callbacks(self, task: "Task"):
192192 self .finished_style = self .default_finished_style
193193
194194
195+ class ProgressTask (Protocol ):
196+ """A protocol for a task in a progress bar.
197+
198+ This protocol defines the expected interface for tasks that can be added to a progress bar.
199+ """
200+
201+ @property
202+ def elapsed (self ):
203+ """Get the elapsed time for this task."""
204+
205+
195206class ProgressBar (Protocol ):
196207 @property
197- def tasks (self ):
208+ def tasks (self ) -> list [ ProgressTask ] :
198209 """Get the tasks in the progress bar."""
199210
200211 def add_task (self , * args , ** kwargs ):
@@ -271,8 +282,8 @@ def elapsed(self):
271282
272283class MarimoProgressBar :
273284 def __init__ (self ) -> None :
274- self .tasks = []
275- self .divergences = {}
285+ self .tasks : list [ ProgressTask ] = []
286+ self .divergences : dict [ int , int ] = {}
276287
277288 def __enter__ (self ):
278289 """Enter the context manager."""
@@ -329,7 +340,6 @@ def __init__(
329340 tune : int ,
330341 progressbar : bool | ProgressBarType = True ,
331342 progressbar_theme : Theme | None = None ,
332- progress : ProgressBar | None = None ,
333343 ):
334344 """
335345 Manage progress bars displayed during sampling.
@@ -406,7 +416,7 @@ def __init__(
406416 self .combined_progress = False
407417 self ._progress = MarimoProgressBar ()
408418 else :
409- self ._progress = progress or create_rich_progress_bar (
419+ self ._progress = create_rich_progress_bar (
410420 self .full_stats ,
411421 progress_columns ,
412422 progressbar = progressbar ,
0 commit comments