def peek(nbytes=0) -> typing.Generator[_Action, Buffer, bytes]:
"""Read output without consuming it.
Read but **does not** consume data from the protocol input.
This is a *non-blocking* primitive, if less data than requested is available,
less data is returned. It is meant to be used in combination with :func:`~ohneio.wait`, but
edge cases and smart people can (and most likely will) prove me wrong.
Args:
nbytes (:obj:`int`, optional): amount of bytes to read *at most*. ``0`` meaning all bytes.
Returns:
bytes: data read from the buffer
"""
input_ = yield _get_input
return input_.peek(nbytes)
评论列表
文章目录