a_sync.py 文件源码

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

项目:a_sync 作者: notion 项目源码 文件源码
def a_input(prompt: str) -> str:
    """Async input prompt."""
    readable = []  # type: List[int]
    print(prompt, end='')
    sys.stdout.flush()
    while not readable:
        readable, _, _ = select.select([sys.stdin], [], [], 0)
        try:
            await asyncio.sleep(0.1)
        except futures.CancelledError:
            print("input cancelled...")
            termios.tcflush(sys.stdin, termios.TCIFLUSH)
            raise
    return sys.stdin.readline().rstrip()


# [ Classes ]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号