printing
langroid/utils/output/printing.py
PrintColored(color)
¶
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.