Method: rich.pretty.Pretty.__rich_console__
Calls: 43, Exceptions: 0, Paths: 3Back
Path 1: 30 calls (0.7)
Console (30)
ConsoleOptions (30)
Text (30) None (30)
1def __rich_console__(
2 self, console: "Console", options: "ConsoleOptions"
3 ) -> "RenderResult":
4 pretty_str = pretty_repr(
5 self._object,
6 max_width=options.max_width - self.margin,
7 indent_size=self.indent_size,
8 max_length=self.max_length,
9 max_string=self.max_string,
10 max_depth=self.max_depth,
11 expand_all=self.expand_all,
12 )
13 pretty_text = Text.from_ansi(
14 pretty_str,
15 justify=self.justify or options.justify,
16 overflow=self.overflow or options.overflow,
17 no_wrap=pick_bool(self.no_wrap, options.no_wrap),
18 style="pretty",
19 )
20 pretty_text = (
21 self.highlighter(pretty_text)
22 if pretty_text
23 else Text(
24 f"{type(self._object)}.__repr__ returned empty string",
25 style="dim italic",
26 )
27 )
28 if self.indent_guides and not options.ascii_only:
29 pretty_text = pretty_text.with_indent_guides(
30 self.indent_size, style="repr.indent"
31 )
32 if self.insert_line and "\n" in pretty_text:
33 yield ""
34 yield pretty_text
Path 2: 12 calls (0.28)
Console (12)
ConsoleOptions (12)
Text (12) None (12)
1def __rich_console__(
2 self, console: "Console", options: "ConsoleOptions"
3 ) -> "RenderResult":
4 pretty_str = pretty_repr(
5 self._object,
6 max_width=options.max_width - self.margin,
7 indent_size=self.indent_size,
8 max_length=self.max_length,
9 max_string=self.max_string,
10 max_depth=self.max_depth,
11 expand_all=self.expand_all,
12 )
13 pretty_text = Text.from_ansi(
14 pretty_str,
15 justify=self.justify or options.justify,
16 overflow=self.overflow or options.overflow,
17 no_wrap=pick_bool(self.no_wrap, options.no_wrap),
18 style="pretty",
19 )
20 pretty_text = (
21 self.highlighter(pretty_text)
22 if pretty_text
23 else Text(
24 f"{type(self._object)}.__repr__ returned empty string",
25 style="dim italic",
26 )
27 )
28 if self.indent_guides and not options.ascii_only:
29 pretty_text = pretty_text.with_indent_guides(
30 self.indent_size, style="repr.indent"
31 )
32 if self.insert_line and "\n" in pretty_text:
33 yield ""
34 yield pretty_text
Path 3: 1 calls (0.02)
Console (1)
ConsoleOptions (1)
'' (1) Text (1) None (1)
1def __rich_console__(
2 self, console: "Console", options: "ConsoleOptions"
3 ) -> "RenderResult":
4 pretty_str = pretty_repr(
5 self._object,
6 max_width=options.max_width - self.margin,
7 indent_size=self.indent_size,
8 max_length=self.max_length,
9 max_string=self.max_string,
10 max_depth=self.max_depth,
11 expand_all=self.expand_all,
12 )
13 pretty_text = Text.from_ansi(
14 pretty_str,
15 justify=self.justify or options.justify,
16 overflow=self.overflow or options.overflow,
17 no_wrap=pick_bool(self.no_wrap, options.no_wrap),
18 style="pretty",
19 )
20 pretty_text = (
21 self.highlighter(pretty_text)
22 if pretty_text
23 else Text(
24 f"{type(self._object)}.__repr__ returned empty string",
25 style="dim italic",
26 )
27 )
28 if self.indent_guides and not options.ascii_only:
29 pretty_text = pretty_text.with_indent_guides(
30 self.indent_size, style="repr.indent"
31 )
32 if self.insert_line and "\n" in pretty_text:
33 yield ""
34 yield pretty_text