ohneio.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:ohneio 作者: acatton 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号