Method: rich.progress.TimeRemainingColumn.render
Calls: 32, Exceptions: 0, Paths: 4Back
Path 1: 14 calls (0.44)
Task (13) SimpleNamespace (1)
Text (14)
1def render(self, task: "Task") -> Text:
2 """Show time remaining."""
3 if self.elapsed_when_finished and task.finished:
4 task_time = task.finished_time
5 style = "progress.elapsed"
6 else:
7 task_time = task.time_remaining
8 style = "progress.remaining"
9
10 if task.total is None:
11 return Text("", style=style)
12
13 if task_time is None:
14 return Text("--:--" if self.compact else "-:--:--", style=style)
15
16 # Based on https://github.com/tqdm/tqdm/blob/master/tqdm/std.py
17 minutes, seconds = divmod(int(task_time), 60)
18 hours, minutes = divmod(minutes, 60)
19
20 if self.compact and not hours:
21 formatted = f"{minutes:02d}:{seconds:02d}"
22 else:
23 formatted = f"{hours:d}:{minutes:02d}:{seconds:02d}"
24
25 return Text(formatted, style=style)
Path 2: 14 calls (0.44)
Task (12) test_time_remaining_column.
Text (14)
1def render(self, task: "Task") -> Text:
2 """Show time remaining."""
3 if self.elapsed_when_finished and task.finished:
4 task_time = task.finished_time
5 style = "progress.elapsed"
6 else:
7 task_time = task.time_remaining
8 style = "progress.remaining"
9
10 if task.total is None:
11 return Text("", style=style)
12
13 if task_time is None:
14 return Text("--:--" if self.compact else "-:--:--", style=style)
15
16 # Based on https://github.com/tqdm/tqdm/blob/master/tqdm/std.py
17 minutes, seconds = divmod(int(task_time), 60)
18 hours, minutes = divmod(minutes, 60)
19
20 if self.compact and not hours:
21 formatted = f"{minutes:02d}:{seconds:02d}"
22 else:
23 formatted = f"{hours:d}:{minutes:02d}:{seconds:02d}"
24
25 return Text(formatted, style=style)
Path 3: 3 calls (0.09)
SimpleNamespace (3)
Text (3)
1def render(self, task: "Task") -> Text:
2 """Show time remaining."""
3 if self.elapsed_when_finished and task.finished:
4 task_time = task.finished_time
5 style = "progress.elapsed"
6 else:
7 task_time = task.time_remaining
8 style = "progress.remaining"
9
10 if task.total is None:
11 return Text("", style=style)
12
13 if task_time is None:
14 return Text("--:--" if self.compact else "-:--:--", style=style)
15
16 # Based on https://github.com/tqdm/tqdm/blob/master/tqdm/std.py
17 minutes, seconds = divmod(int(task_time), 60)
18 hours, minutes = divmod(minutes, 60)
19
20 if self.compact and not hours:
21 formatted = f"{minutes:02d}:{seconds:02d}"
22 else:
23 formatted = f"{hours:d}:{minutes:02d}:{seconds:02d}"
24
25 return Text(formatted, style=style)
Path 4: 1 calls (0.03)
SimpleNamespace (1)
Text (1)
1def render(self, task: "Task") -> Text:
2 """Show time remaining."""
3 if self.elapsed_when_finished and task.finished:
4 task_time = task.finished_time
5 style = "progress.elapsed"
6 else:
7 task_time = task.time_remaining
8 style = "progress.remaining"
9
10 if task.total is None:
11 return Text("", style=style)
12
13 if task_time is None:
14 return Text("--:--" if self.compact else "-:--:--", style=style)
15
16 # Based on https://github.com/tqdm/tqdm/blob/master/tqdm/std.py
17 minutes, seconds = divmod(int(task_time), 60)
18 hours, minutes = divmod(minutes, 60)
19
20 if self.compact and not hours:
21 formatted = f"{minutes:02d}:{seconds:02d}"
22 else:
23 formatted = f"{hours:d}:{minutes:02d}:{seconds:02d}"
24
25 return Text(formatted, style=style)