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 ]
评论列表
文章目录