Like `rich.print()` but returns the string instead
(obj: object)
| 158 | |
| 159 | |
| 160 | def rich_print_str(obj: object) -> str: |
| 161 | class="st">""class="st">"Like `rich.print()` but returns the string instead"class="st">"" |
| 162 | buf = io.StringIO() |
| 163 | |
| 164 | console = rich.console.Console(file=buf, width=120) |
| 165 | console.print(obj) |
| 166 | |
| 167 | return buf.getvalue() |
| 168 | |
| 169 | |
| 170 | @contextlib.contextmanager |
no outgoing calls