carputils
Doxygen code documentation for the python framework controlling openCARP
|
Some tools for handling output streams (stdout, etc.) More...
Classes | |
class | DummyStream |
A placeholder stream that simply ignores the write instruction. More... | |
class | MultiStream |
A stream that forwards on the write call to other streams. More... | |
class | RegexCallbackStream |
Functions | |
def | merge (streams) |
Merge the provided streams into a single one. More... | |
def | divert_std (replacement) |
Context manager to temporarily replace sys.stdout and sys.stderr. More... | |
Some tools for handling output streams (stdout, etc.)
def carputils.stream.divert_std | ( | replacement | ) |
Context manager to temporarily replace sys.stdout and sys.stderr.
Either create a file object:
or create a string stream:
and then use thus context manager to ensure that all stdout and stderr gets written to the desired output:
replacement | string stream Replacement string stream object - in practice, anything with a write |
method |
def carputils.stream.merge | ( | streams | ) |
Merge the provided streams into a single one.