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

Method advance

rich/progress.py:1517–1545  ·  view source on GitHub ↗

Advance task by a number of steps. Args: task_id (TaskID): ID of task. advance (float): Number of steps to advance. Default is 1.

(self, task_id: TaskID, advance: float = 1)

Source from the content-addressed store, hash-verified

1515 self.refresh()
1516
1517 def advance(self, task_id: TaskID, advance: float = 1) -> None:
1518 """Advance task by a number of steps.
1519
1520 Args:
1521 task_id (TaskID): ID of task.
1522 advance (float): Number of steps to advance. Default is 1.
1523 """
1524 current_time = self.get_time()
1525 with self._lock:
1526 task = self._tasks[task_id]
1527 completed_start = task.completed
1528 task.completed += advance
1529 update_completed = task.completed - completed_start
1530 old_sample_time = current_time - self.speed_estimate_period
1531 _progress = task._progress
1532
1533 popleft = _progress.popleft
1534 while _progress and _progress[0].timestamp < old_sample_time:
1535 popleft()
1536 while len(_progress) > 1000:
1537 popleft()
1538 _progress.append(ProgressSample(current_time, update_completed))
1539 if (
1540 task.total is not None
1541 and task.completed >= task.total
1542 and task.finished_time is None
1543 ):
1544 task.finished_time = task.elapsed
1545 task.finished_speed = task.speed
1546
1547 def refresh(self) -> None:
1548 """Refresh (render) the progress information."""

Callers 11

make_progressFunction · 0.95
test_columnsFunction · 0.95
test_resetFunction · 0.95
jobs.pyFile · 0.80
live_progress.pyFile · 0.80
fullscreen.pyFile · 0.80
__next__Method · 0.80
readMethod · 0.80
readintoMethod · 0.80
readlineMethod · 0.80
readlinesMethod · 0.80

Calls 3

ProgressSampleClass · 0.85
get_timeMethod · 0.80
appendMethod · 0.45

Tested by 3

make_progressFunction · 0.76
test_columnsFunction · 0.76
test_resetFunction · 0.76