File: //usr/lib/python3.5/__pycache__/getpass.cpython-35.pyc
Fa @ s4 d Z d d l Z d d l Z d d l Z d d l Z d d l Z d d d g Z Gd d d e Z d d d d Z d d d
d Z
d d d d
Z d d d d d Z d d Z
y d d l Z e j e j f WnI e e f k
r)y d d l Z Wn e k
re Z Yn Xe
Z Yn Xe Z d S)a Utilities to get a password and/or the current user name.
getpass(prompt[, stream]) - Prompt for a password, with echo turned off.
getuser() - Get the user name from the environment or password database.
GetPassWarning - This UserWarning is issued when getpass() cannot prevent
echoing of the password contents while reading.
On Windows, the msvcrt module will be used.
On the Mac EasyDialogs.AskPassword is used, if available.
NgetpassgetuserGetPassWarningc @ s e Z d Z d S)r N)__name__
__module____qualname__ r r /usr/lib/python3.5/getpass.pyr s z
Password: c . C s$ d } t j } yg t j d t j t j B } t j | d } | j | t j | } | j | | s{ | } Wn t
k
r} zj | j y t j
j } Wn- t t f k
r d } t | | } Yn Xt j
} | s t j } WYd d } ~ Xn X| d k ry t j | } | d d } | d t j M<t j }
t t d rn|
t j O}
z, t j | |
| t | | d | } Wd t j | |
| | j XWnI t j k
r| d k r | | k r| j t | | } Yn X| j d | SWd QRXd S)a Prompt for a password, with echo turned off.
Args:
prompt: Written on stream to ask for the input. Default: 'Password: '
stream: A writable file object to display the prompt. Defaults to
the tty. If no tty is available defaults to sys.stderr.
Returns:
The seKr3t input.
Raises:
EOFError: If our input tty or stdin was closed.
GetPassWarning: When we were unable to turn echo off on the input.
Always restores terminal settings before returning.
Nz/dev/ttyzw+ TCSASOFTinput
)
contextlib ExitStackosopenO_RDWRO_NOCTTYioFileIO
enter_context
TextIOWrapperOSErrorclosesysstdinfilenoAttributeError
ValueErrorfallback_getpassstderrtermios tcgetattrZECHOZ TCSAFLUSHhasattrr tcsetattr
_raw_inputflusherrorwrite)promptstreamZpasswdstackfdZttyr eoldnewZtcsetattr_flagsr r r unix_getpass sR
r0 c C s t j t j k r t | | Sx | D] } t j | q&