3
3
/usr/bin/python3
# pylint: disable=R,C,W,E
"""
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
"""
import os
import sys
if os.name == "nt":
from msvcrt import getch as _win_getch
else:
import tty
import termios
class GetPass(object):
def _unix_getch(self):
fd = sys.stdin.fileno()
old_settings = termios.tcgetattr(fd)
try:
tty.setraw(sys.stdin.fileno())
ch = sys.stdin.read(1)
finally:
termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
return ch
return pw
getpass = GetPass()