cli.py 文件源码

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

项目:acton 作者: chengsoonong 项目源码 文件源码
def read_bytes_from_buffer(n: int, buffer: BinaryIO) -> bytes:
    """Reads n bytes from stdin, blocking until all bytes are received.

    Parameters
    ----------
    n
        How many bytes to read.
    buffer
        Which buffer to read from.

    Returns
    -------
    bytes
        Exactly n bytes.
    """
    b = b''
    while len(b) < n:
        b += buffer.read(n - len(b))
    assert len(b) == n
    return b
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号