@@ -192,9 +192,20 @@ def callbacks(self, task: "Task"):
192
192
self .finished_style = self .default_finished_style
193
193
194
194
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
+
195
206
class ProgressBar (Protocol ):
196
207
@property
197
- def tasks (self ):
208
+ def tasks (self ) -> list [ ProgressTask ] :
198
209
"""Get the tasks in the progress bar."""
199
210
200
211
def add_task (self , * args , ** kwargs ):
@@ -271,8 +282,8 @@ def elapsed(self):
271
282
272
283
class MarimoProgressBar :
273
284
def __init__ (self ) -> None :
274
- self .tasks = []
275
- self .divergences = {}
285
+ self .tasks : list [ ProgressTask ] = []
286
+ self .divergences : dict [ int , int ] = {}
276
287
277
288
def __enter__ (self ):
278
289
"""Enter the context manager."""
@@ -329,7 +340,6 @@ def __init__(
329
340
tune : int ,
330
341
progressbar : bool | ProgressBarType = True ,
331
342
progressbar_theme : Theme | None = None ,
332
- progress : ProgressBar | None = None ,
333
343
):
334
344
"""
335
345
Manage progress bars displayed during sampling.
@@ -406,7 +416,7 @@ def __init__(
406
416
self .combined_progress = False
407
417
self ._progress = MarimoProgressBar ()
408
418
else :
409
- self ._progress = progress or create_rich_progress_bar (
419
+ self ._progress = create_rich_progress_bar (
410
420
self .full_stats ,
411
421
progress_columns ,
412
422
progressbar = progressbar ,
0 commit comments