MCPcopy
hub / github.com/Textualize/rich / run_steps

Function run_steps

examples/dynamic_progress.py:23–41  ·  view source on GitHub ↗

Run steps for a single app, and update corresponding progress bars.

(name, step_times, app_steps_task_id)

Source from the content-addressed store, hash-verified

21
22
23def run_steps(name, step_times, app_steps_task_id):
24 """Run steps for a single app, and update corresponding progress bars."""
25
26 for idx, step_time in enumerate(step_times):
27 # add progress bar for this step (time elapsed + spinner)
28 action = step_actions[idx]
29 step_task_id = step_progress.add_task("", action=action, name=name)
30
31 # run steps, update progress
32 for _ in range(step_time):
33 time.sleep(0.5)
34 step_progress.update(step_task_id, advance=1)
35
36 # stop and hide progress bar for this step when done
37 step_progress.stop_task(step_task_id)
38 step_progress.update(step_task_id, visible=False)
39
40 # also update progress bar for current app when step is done
41 app_steps_progress.update(app_steps_task_id, advance=1)
42
43
44# progress bar for current app showing only elapsed time,

Callers 1

Calls 3

add_taskMethod · 0.80
stop_taskMethod · 0.80
updateMethod · 0.45

Tested by

no test coverage detected