(
self, console: "Console", options: "ConsoleOptions"
)
| 302 | self.insert_line = insert_line |
| 303 | |
| 304 | def __rich_console__( |
| 305 | self, console: "Console", options: "ConsoleOptions" |
| 306 | ) -> "RenderResult": |
| 307 | pretty_str = pretty_repr( |
| 308 | self._object, |
| 309 | max_width=options.max_width - self.margin, |
| 310 | indent_size=self.indent_size, |
| 311 | max_length=self.max_length, |
| 312 | max_string=self.max_string, |
| 313 | max_depth=self.max_depth, |
| 314 | expand_all=self.expand_all, |
| 315 | ) |
| 316 | pretty_text = Text.from_ansi( |
| 317 | pretty_str, |
| 318 | justify=self.justify or options.justify, |
| 319 | overflow=self.overflow or options.overflow, |
| 320 | no_wrap=pick_bool(self.no_wrap, options.no_wrap), |
| 321 | style="pretty", |
| 322 | ) |
| 323 | pretty_text = ( |
| 324 | self.highlighter(pretty_text) |
| 325 | if pretty_text |
| 326 | else Text( |
| 327 | f"{type(self._object)}.__repr__ returned empty string", |
| 328 | style="dim italic", |
| 329 | ) |
| 330 | ) |
| 331 | if self.indent_guides and not options.ascii_only: |
| 332 | pretty_text = pretty_text.with_indent_guides( |
| 333 | self.indent_size, style="repr.indent" |
| 334 | ) |
| 335 | if self.insert_line and "\n" in pretty_text: |
| 336 | yield "" |
| 337 | yield pretty_text |
| 338 | |
| 339 | def __rich_measure__( |
| 340 | self, console: "Console", options: "ConsoleOptions" |
nothing calls this directly
no test coverage detected