iomux

IO buffer multiplexer.

Base class

class iomux.IOMux

IO buffer multiplexer.

Receives a io.IOBase as a generic argument and can create proxy IO objects that multiplex the values. This makes it possible to keep the ordering between IO objects, which is useful if you are for eg. capturing stdout and stderr and want to be able to replay the output in the correct order.

class Proxy(owner: iomux.IOMux[_V], name: str)

IO object proxy.

Will make sure a IO object for correspondent entry is at the top of the stack, and proxy all instance attributes, including methods, from that object.

entries()Iterator[Tuple[str, _T]]
entries(name: str)Iterator[_T]

Helper classes

class iomux.BytesMux

io.BytesIO multiplexer.

getvalue(name: Optional[str] = None)bytes

Returns the joined value from all buffers.

values()Iterator[Tuple[str, bytes]]

Generator that provides tuples containing the entry name and IO buffer value.

class iomux.StringMux

io.StringIO multiplexer.

getvalue(name: Optional[str] = None)str

Returns the joined value from all buffers.

values()Iterator[Tuple[str, str]]

Generator that provides tuples containing the entry name and IO buffer value.