Skip to content

Commit 76eecf5

Browse files
committed
linux: docstring and typhint for readchar()
1 parent aa78f8c commit 76eecf5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

readchar/_posix_read.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@
22
import termios
33
import tty
44

5+
56
# Initially taken from:
67
# http://code.activestate.com/recipes/134892/
78
# Thanks to Danny Yoo
8-
def readchar():
9+
def readchar() -> str:
10+
"""Reads a single character from the input stream.
11+
Blocks until a character is available."""
12+
913
fd = sys.stdin.fileno()
1014
old_settings = termios.tcgetattr(fd)
1115
try:

0 commit comments

Comments
 (0)