Method: rich.progress.Progress.add_task
Calls: 27, Exceptions: 0, Paths: 2Back
Path 1: 24 calls (0.89)
'foo' (7) 'bar' (3) 'baz' (3) 'egg' (3) 'test' (3) 'Reading...' (3) 'start' (1) 'Reading' (1)
True (24)
100.0 (13) 13 (4) 30 (3) 3.0 (3) None (1)
0 (24)
True (21) False (3)
{} (24)
0 (15) 1 (3) 2 (3) 3 (3)
1def add_task(
2 self,
3 description: str,
4 start: bool = True,
5 total: Optional[float] = 100.0,
6 completed: int = 0,
7 visible: bool = True,
8 **fields: Any,
9 ) -> TaskID:
10 """Add a new 'task' to the Progress display.
11
12 Args:
13 description (str): A description of the task.
14 start (bool, optional): Start the task immediately (to calculate elapsed time). If set to False,
15 you will need to call `start` manually. Defaults to True.
16 total (float, optional): Number of total steps in the progress if known.
17 Set to None to render a pulsing animation. Defaults to 100.
18 completed (int, optional): Number of steps completed so far. Defaults to 0.
19 visible (bool, optional): Enable display of the task. Defaults to True.
20 **fields (str): Additional data fields required for rendering.
21
22 Returns:
23 TaskID: An ID you can use when calling `update`.
24 """
25 with self._lock:
26 task = Task(
27 self._task_index,
28 description,
29 total,
30 completed,
31 visible=visible,
32 fields=fields,
33 _get_time=self.get_time,
34 _lock=self._lock,
35 )
36 self._tasks[self._task_index] = task
37 if start:
38 self.start_task(self._task_index)
39 new_task_index = self._task_index
40 self._task_index = TaskID(int(self._task_index) + 1)
41 self.refresh()
42 return new_task_index
Path 2: 3 calls (0.11)
'foo2' (3)
False (3)
100.0 (3)
50 (3)
True (3)
{} (3)
4 (3)
1def add_task(
2 self,
3 description: str,
4 start: bool = True,
5 total: Optional[float] = 100.0,
6 completed: int = 0,
7 visible: bool = True,
8 **fields: Any,
9 ) -> TaskID:
10 """Add a new 'task' to the Progress display.
11
12 Args:
13 description (str): A description of the task.
14 start (bool, optional): Start the task immediately (to calculate elapsed time). If set to False,
15 you will need to call `start` manually. Defaults to True.
16 total (float, optional): Number of total steps in the progress if known.
17 Set to None to render a pulsing animation. Defaults to 100.
18 completed (int, optional): Number of steps completed so far. Defaults to 0.
19 visible (bool, optional): Enable display of the task. Defaults to True.
20 **fields (str): Additional data fields required for rendering.
21
22 Returns:
23 TaskID: An ID you can use when calling `update`.
24 """
25 with self._lock:
26 task = Task(
27 self._task_index,
28 description,
29 total,
30 completed,
31 visible=visible,
32 fields=fields,
33 _get_time=self.get_time,
34 _lock=self._lock,
35 )
36 self._tasks[self._task_index] = task
37 if start:
38 self.start_task(self._task_index)
39 new_task_index = self._task_index
40 self._task_index = TaskID(int(self._task_index) + 1)
41 self.refresh()
42 return new_task_index