Method: rich.table.Table.__rich_console__
Calls: 118, Exceptions: 0, Paths: 5Back
Path 1: 95 calls (0.81)
Console (95)
ConsoleOptions (95)
Segment (3457)
1def __rich_console__(
2 self, console: "Console", options: "ConsoleOptions"
3 ) -> "RenderResult":
4
5 if not self.columns:
6 yield Segment("\n")
7 return
8
9 max_width = options.max_width
10 if self.width is not None:
11 max_width = self.width
12
13 extra_width = self._extra_width
14 widths = self._calculate_column_widths(
15 console, options.update_width(max_width - extra_width)
16 )
17 table_width = sum(widths) + extra_width
18
19 render_options = options.update(
20 width=table_width, highlight=self.highlight, height=None
21 )
22
23 def render_annotation(
24 text: TextType, style: StyleType, justify: "JustifyMethod" = "center"
25 ) -> "RenderResult":
26 render_text = (
27 console.render_str(text, style=style, highlight=False)
28 if isinstance(text, str)
29 else text
30 )
31 return console.render(
32 render_text, options=render_options.update(justify=justify)
33 )
34
35 if self.title:
36 yield from render_annotation(
37 self.title,
38 style=Style.pick_first(self.title_style, "table.title"),
39 justify=self.title_justify,
40 )
41 yield from self._render(console, render_options, widths)
42 if self.caption:
43 yield from render_annotation(
44 self.caption,
45 style=Style.pick_first(self.caption_style, "table.caption"),
46 justify=self.caption_justify,
47 )
Path 2: 18 calls (0.15)
Console (18)
ConsoleOptions (18)
Segment (1024) None (18)
1def __rich_console__(
2 self, console: "Console", options: "ConsoleOptions"
3 ) -> "RenderResult":
4
5 if not self.columns:
6 yield Segment("\n")
7 return
8
9 max_width = options.max_width
10 if self.width is not None:
11 max_width = self.width
12
13 extra_width = self._extra_width
14 widths = self._calculate_column_widths(
15 console, options.update_width(max_width - extra_width)
16 )
17 table_width = sum(widths) + extra_width
18
19 render_options = options.update(
20 width=table_width, highlight=self.highlight, height=None
21 )
22
23 def render_annotation(
24 text: TextType, style: StyleType, justify: "JustifyMethod" = "center"
25 ) -> "RenderResult":
26 render_text = (
27 console.render_str(text, style=style, highlight=False)
28 if isinstance(text, str)
29 else text
30 )
31 return console.render(
32 render_text, options=render_options.update(justify=justify)
33 )
34
35 if self.title:
36 yield from render_annotation(
37 self.title,
38 style=Style.pick_first(self.title_style, "table.title"),
39 justify=self.title_justify,
40 )
41 yield from self._render(console, render_options, widths)
42 if self.caption:
43 yield from render_annotation(
44 self.caption,
45 style=Style.pick_first(self.caption_style, "table.caption"),
46 justify=self.caption_justify,
47 )
Path 3: 3 calls (0.03)
Console (3)
ConsoleOptions (3)
Segment (346) None (3)
1def __rich_console__(
2 self, console: "Console", options: "ConsoleOptions"
3 ) -> "RenderResult":
4
5 if not self.columns:
6 yield Segment("\n")
7 return
8
9 max_width = options.max_width
10 if self.width is not None:
11 max_width = self.width
12
13 extra_width = self._extra_width
14 widths = self._calculate_column_widths(
15 console, options.update_width(max_width - extra_width)
16 )
17 table_width = sum(widths) + extra_width
18
19 render_options = options.update(
20 width=table_width, highlight=self.highlight, height=None
21 )
22
23 def render_annotation(
24 text: TextType, style: StyleType, justify: "JustifyMethod" = "center"
25 ) -> "RenderResult":
26 render_text = (
27 console.render_str(text, style=style, highlight=False)
28 if isinstance(text, str)
29 else text
30 )
31 return console.render(
32 render_text, options=render_options.update(justify=justify)
33 )
34
35 if self.title:
36 yield from render_annotation(
37 self.title,
38 style=Style.pick_first(self.title_style, "table.title"),
39 justify=self.title_justify,
40 )
41 yield from self._render(console, render_options, widths)
42 if self.caption:
43 yield from render_annotation(
44 self.caption,
45 style=Style.pick_first(self.caption_style, "table.caption"),
46 justify=self.caption_justify,
47 )
Path 4: 1 calls (0.01)
Console (1)
ConsoleOptions (1)
Segment (1026)
1def __rich_console__(
2 self, console: "Console", options: "ConsoleOptions"
3 ) -> "RenderResult":
4
5 if not self.columns:
6 yield Segment("\n")
7 return
8
9 max_width = options.max_width
10 if self.width is not None:
11 max_width = self.width
12
13 extra_width = self._extra_width
14 widths = self._calculate_column_widths(
15 console, options.update_width(max_width - extra_width)
16 )
17 table_width = sum(widths) + extra_width
18
19 render_options = options.update(
20 width=table_width, highlight=self.highlight, height=None
21 )
22
23 def render_annotation(
24 text: TextType, style: StyleType, justify: "JustifyMethod" = "center"
25 ) -> "RenderResult":
26 render_text = (
27 console.render_str(text, style=style, highlight=False)
28 if isinstance(text, str)
29 else text
30 )
31 return console.render(
32 render_text, options=render_options.update(justify=justify)
33 )
34
35 if self.title:
36 yield from render_annotation(
37 self.title,
38 style=Style.pick_first(self.title_style, "table.title"),
39 justify=self.title_justify,
40 )
41 yield from self._render(console, render_options, widths)
42 if self.caption:
43 yield from render_annotation(
44 self.caption,
45 style=Style.pick_first(self.caption_style, "table.caption"),
46 justify=self.caption_justify,
47 )
Path 5: 1 calls (0.01)
Console (1)
ConsoleOptions (1)
Segment (1)
None (1)
1def __rich_console__(
2 self, console: "Console", options: "ConsoleOptions"
3 ) -> "RenderResult":
4
5 if not self.columns:
6 yield Segment("\n")
7 return
8
9 max_width = options.max_width
10 if self.width is not None:
11 max_width = self.width
12
13 extra_width = self._extra_width
14 widths = self._calculate_column_widths(
15 console, options.update_width(max_width - extra_width)
16 )
17 table_width = sum(widths) + extra_width
18
19 render_options = options.update(
20 width=table_width, highlight=self.highlight, height=None
21 )
22
23 def render_annotation(
24 text: TextType, style: StyleType, justify: "JustifyMethod" = "center"
25 ) -> "RenderResult":
26 render_text = (
27 console.render_str(text, style=style, highlight=False)
28 if isinstance(text, str)
29 else text
30 )
31 return console.render(
32 render_text, options=render_options.update(justify=justify)
33 )
34
35 if self.title:
36 yield from render_annotation(
37 self.title,
38 style=Style.pick_first(self.title_style, "table.title"),
39 justify=self.title_justify,
40 )
41 yield from self._render(console, render_options, widths)
42 if self.caption:
43 yield from render_annotation(
44 self.caption,
45 style=Style.pick_first(self.caption_style, "table.caption"),
46 justify=self.caption_justify,
47 )