stouputils.decorators.silent module#
- silent(
- func: Callable[..., T],
- *,
- mute_stderr: bool = False,
- silent(
- func: None = None,
- *,
- mute_stderr: bool = False,
Decorator that makes a function silent (disable stdout, and stderr if specified).
Alternative to
Muffle.- Parameters:
func (Callable[..., T] | None) – Function to make silent
mute_stderr (bool) – Whether to mute stderr or not
Examples
>>> @silent ... def test(): ... print("Hello, world!") >>> test()
>>> @silent(mute_stderr=True) ... def test2(): ... print("Hello, world!") >>> test2()
>>> silent(print)("Hello, world!")