printing
langroid/utils/output/printing.py
PrintColored(color)
¶
print_long_text(color, style, preamble, text, chars=None)
¶
Print text (possibly truncated) after preamble, in the given color/style.
text is printed literally: neither Rich markup nor terminal escape
sequences in it are interpreted.
Source code in langroid/utils/output/printing.py
silence_stdout()
¶
Temporarily silence all output to stdout and from rich.print.
This context manager redirects all output written to stdout (which includes outputs from the built-in print function and rich.print) to /dev/null on UNIX-like systems or NUL on Windows. Once the context block exits, stdout is restored to its original state.
Example
with silence_stdout_and_rich(): print("This won't be printed") rich.print("This also won't be printed")
Note
This suppresses both standard print functions and the rich library outputs.