Method: rich.progress_bar.ProgressBar.__rich_console__
Calls: 29, Exceptions: 0, Paths: 6Back
Path 1: 10 calls (0.34)
Console (10)
ConsoleOptions (10)
Segment (10)
1def __rich_console__(
2 self, console: Console, options: ConsoleOptions
3 ) -> RenderResult:
4
5 width = min(self.width or options.max_width, options.max_width)
6 ascii = options.legacy_windows or options.ascii_only
7 should_pulse = self.pulse or self.total is None
8 if should_pulse:
9 yield from self._render_pulse(console, width, ascii=ascii)
10 return
11
12 completed: Optional[float] = (
13 min(self.total, max(0, self.completed)) if self.total is not None else None
14 )
15
16 bar = "-" if ascii else "━"
17 half_bar_right = " " if ascii else "╸"
18 half_bar_left = " " if ascii else "╺"
19 complete_halves = (
20 int(width * 2 * completed / self.total)
21 if self.total and completed is not None
22 else width * 2
23 )
24 bar_count = complete_halves // 2
25 half_bar_count = complete_halves % 2
26 style = console.get_style(self.style)
27 is_finished = self.total is None or self.completed >= self.total
28 complete_style = console.get_style(
29 self.finished_style if is_finished else self.complete_style
30 )
31 _Segment = Segment
32 if bar_count:
33 yield _Segment(bar * bar_count, complete_style)
34 if half_bar_count:
35 yield _Segment(half_bar_right * half_bar_count, complete_style)
36
37 if not console.no_color:
38 remaining_bars = width - bar_count - half_bar_count
39 if remaining_bars and console.color_system is not None:
40 if not half_bar_count and bar_count:
41 yield _Segment(half_bar_left, style)
42 remaining_bars -= 1
43 if remaining_bars:
44 yield _Segment(bar * remaining_bars, style)
Path 2: 7 calls (0.24)
Console (7)
ConsoleOptions (7)
Segment (7) None (7)
1def __rich_console__(
2 self, console: Console, options: ConsoleOptions
3 ) -> RenderResult:
4
5 width = min(self.width or options.max_width, options.max_width)
6 ascii = options.legacy_windows or options.ascii_only
7 should_pulse = self.pulse or self.total is None
8 if should_pulse:
9 yield from self._render_pulse(console, width, ascii=ascii)
10 return
11
12 completed: Optional[float] = (
13 min(self.total, max(0, self.completed)) if self.total is not None else None
14 )
15
16 bar = "-" if ascii else "━"
17 half_bar_right = " " if ascii else "╸"
18 half_bar_left = " " if ascii else "╺"
19 complete_halves = (
20 int(width * 2 * completed / self.total)
21 if self.total and completed is not None
22 else width * 2
23 )
24 bar_count = complete_halves // 2
25 half_bar_count = complete_halves % 2
26 style = console.get_style(self.style)
27 is_finished = self.total is None or self.completed >= self.total
28 complete_style = console.get_style(
29 self.finished_style if is_finished else self.complete_style
30 )
31 _Segment = Segment
32 if bar_count:
33 yield _Segment(bar * bar_count, complete_style)
34 if half_bar_count:
35 yield _Segment(half_bar_right * half_bar_count, complete_style)
36
37 if not console.no_color:
38 remaining_bars = width - bar_count - half_bar_count
39 if remaining_bars and console.color_system is not None:
40 if not half_bar_count and bar_count:
41 yield _Segment(half_bar_left, style)
42 remaining_bars -= 1
43 if remaining_bars:
44 yield _Segment(bar * remaining_bars, style)
Path 3: 5 calls (0.17)
Console (5)
ConsoleOptions (5)
Segment (15) None (5)
1def __rich_console__(
2 self, console: Console, options: ConsoleOptions
3 ) -> RenderResult:
4
5 width = min(self.width or options.max_width, options.max_width)
6 ascii = options.legacy_windows or options.ascii_only
7 should_pulse = self.pulse or self.total is None
8 if should_pulse:
9 yield from self._render_pulse(console, width, ascii=ascii)
10 return
11
12 completed: Optional[float] = (
13 min(self.total, max(0, self.completed)) if self.total is not None else None
14 )
15
16 bar = "-" if ascii else "━"
17 half_bar_right = " " if ascii else "╸"
18 half_bar_left = " " if ascii else "╺"
19 complete_halves = (
20 int(width * 2 * completed / self.total)
21 if self.total and completed is not None
22 else width * 2
23 )
24 bar_count = complete_halves // 2
25 half_bar_count = complete_halves % 2
26 style = console.get_style(self.style)
27 is_finished = self.total is None or self.completed >= self.total
28 complete_style = console.get_style(
29 self.finished_style if is_finished else self.complete_style
30 )
31 _Segment = Segment
32 if bar_count:
33 yield _Segment(bar * bar_count, complete_style)
34 if half_bar_count:
35 yield _Segment(half_bar_right * half_bar_count, complete_style)
36
37 if not console.no_color:
38 remaining_bars = width - bar_count - half_bar_count
39 if remaining_bars and console.color_system is not None:
40 if not half_bar_count and bar_count:
41 yield _Segment(half_bar_left, style)
42 remaining_bars -= 1
43 if remaining_bars:
44 yield _Segment(bar * remaining_bars, style)
Path 4: 3 calls (0.1)
Console (3)
ConsoleOptions (3)
Segment (9) None (3)
1def __rich_console__(
2 self, console: Console, options: ConsoleOptions
3 ) -> RenderResult:
4
5 width = min(self.width or options.max_width, options.max_width)
6 ascii = options.legacy_windows or options.ascii_only
7 should_pulse = self.pulse or self.total is None
8 if should_pulse:
9 yield from self._render_pulse(console, width, ascii=ascii)
10 return
11
12 completed: Optional[float] = (
13 min(self.total, max(0, self.completed)) if self.total is not None else None
14 )
15
16 bar = "-" if ascii else "━"
17 half_bar_right = " " if ascii else "╸"
18 half_bar_left = " " if ascii else "╺"
19 complete_halves = (
20 int(width * 2 * completed / self.total)
21 if self.total and completed is not None
22 else width * 2
23 )
24 bar_count = complete_halves // 2
25 half_bar_count = complete_halves % 2
26 style = console.get_style(self.style)
27 is_finished = self.total is None or self.completed >= self.total
28 complete_style = console.get_style(
29 self.finished_style if is_finished else self.complete_style
30 )
31 _Segment = Segment
32 if bar_count:
33 yield _Segment(bar * bar_count, complete_style)
34 if half_bar_count:
35 yield _Segment(half_bar_right * half_bar_count, complete_style)
36
37 if not console.no_color:
38 remaining_bars = width - bar_count - half_bar_count
39 if remaining_bars and console.color_system is not None:
40 if not half_bar_count and bar_count:
41 yield _Segment(half_bar_left, style)
42 remaining_bars -= 1
43 if remaining_bars:
44 yield _Segment(bar * remaining_bars, style)
Path 5: 3 calls (0.1)
Console (3)
ConsoleOptions (3)
Segment (120)
None (3)
1def __rich_console__(
2 self, console: Console, options: ConsoleOptions
3 ) -> RenderResult:
4
5 width = min(self.width or options.max_width, options.max_width)
6 ascii = options.legacy_windows or options.ascii_only
7 should_pulse = self.pulse or self.total is None
8 if should_pulse:
9 yield from self._render_pulse(console, width, ascii=ascii)
10 return
11
12 completed: Optional[float] = (
13 min(self.total, max(0, self.completed)) if self.total is not None else None
14 )
15
16 bar = "-" if ascii else "━"
17 half_bar_right = " " if ascii else "╸"
18 half_bar_left = " " if ascii else "╺"
19 complete_halves = (
20 int(width * 2 * completed / self.total)
21 if self.total and completed is not None
22 else width * 2
23 )
24 bar_count = complete_halves // 2
25 half_bar_count = complete_halves % 2
26 style = console.get_style(self.style)
27 is_finished = self.total is None or self.completed >= self.total
28 complete_style = console.get_style(
29 self.finished_style if is_finished else self.complete_style
30 )
31 _Segment = Segment
32 if bar_count:
33 yield _Segment(bar * bar_count, complete_style)
34 if half_bar_count:
35 yield _Segment(half_bar_right * half_bar_count, complete_style)
36
37 if not console.no_color:
38 remaining_bars = width - bar_count - half_bar_count
39 if remaining_bars and console.color_system is not None:
40 if not half_bar_count and bar_count:
41 yield _Segment(half_bar_left, style)
42 remaining_bars -= 1
43 if remaining_bars:
44 yield _Segment(bar * remaining_bars, style)
Path 6: 1 calls (0.03)
Console (1)
ConsoleOptions (1)
Segment (1)
1def __rich_console__(
2 self, console: Console, options: ConsoleOptions
3 ) -> RenderResult:
4
5 width = min(self.width or options.max_width, options.max_width)
6 ascii = options.legacy_windows or options.ascii_only
7 should_pulse = self.pulse or self.total is None
8 if should_pulse:
9 yield from self._render_pulse(console, width, ascii=ascii)
10 return
11
12 completed: Optional[float] = (
13 min(self.total, max(0, self.completed)) if self.total is not None else None
14 )
15
16 bar = "-" if ascii else "━"
17 half_bar_right = " " if ascii else "╸"
18 half_bar_left = " " if ascii else "╺"
19 complete_halves = (
20 int(width * 2 * completed / self.total)
21 if self.total and completed is not None
22 else width * 2
23 )
24 bar_count = complete_halves // 2
25 half_bar_count = complete_halves % 2
26 style = console.get_style(self.style)
27 is_finished = self.total is None or self.completed >= self.total
28 complete_style = console.get_style(
29 self.finished_style if is_finished else self.complete_style
30 )
31 _Segment = Segment
32 if bar_count:
33 yield _Segment(bar * bar_count, complete_style)
34 if half_bar_count:
35 yield _Segment(half_bar_right * half_bar_count, complete_style)
36
37 if not console.no_color:
38 remaining_bars = width - bar_count - half_bar_count
39 if remaining_bars and console.color_system is not None:
40 if not half_bar_count and bar_count:
41 yield _Segment(half_bar_left, style)
42 remaining_bars -= 1
43 if remaining_bars:
44 yield _Segment(bar * remaining_bars, style)