Your IP : 3.129.23.217


Current Path : /lib64/python2.7/
Upload File :
Current File : //lib64/python2.7/getpass.pyc

�
�mec@s9dZddlZddlZddlZdddgZdefd��YZddd�Zddd	�Z	ddd
�Z
dddd�Zd
�Zy ddl
Z
e
je
jfWnueefk
r.yddlZWnEek
r$yddlmZWnek
re
Zq+XeZq5Xe	ZnXeZdS(s�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.

i����NtgetpasstgetusertGetPassWarningcBseZRS((t__name__t
__module__(((s/usr/lib64/python2.7/getpass.pyRss
Password: c
Cs�d}d}yJtjdtjtjB�}tj|dd�}|}|sU|}nWnjtk
r�}ytjj	�}Wn&t
tfk
r�t||�}nXtj}|s�tj
}q�nX|dk	r�d}y�tj|�}|}|dctjM<tj}	ttd�r*|	tjO}	nz,tj||	|�t||d|�}Wdtj||	|�|j�XWq�tjk
r�}|dk	r��n~~t||�}q�Xn|jd�|S(	sPrompt 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.
    s/dev/ttysw+iitTCSASOFTtinputNs
(tNonetostopentO_RDWRtO_NOCTTYtfdopentEnvironmentErrortsyststdintfilenotAttributeErrort
ValueErrortfallback_getpasststderrttermiost	tcgetattrtECHOt	TCSAFLUSHthasattrRt	tcsetattrt
_raw_inputtflushterrortwrite(
tprompttstreamtfdtttyRtetpasswdtoldtnewttcsetattr_flags((s/usr/lib64/python2.7/getpass.pytunix_getpasssJ
		
cCs�tjtjk	rt||�Sddl}x|D]}|j|�q2Wd}xc|j�}|dksv|dkrzPn|dkr�t�n|dkr�|d }qR||}qR|jd�|jd�|S(s9Prompt for password with echo off, using Windows getch().i����Nts
s
ss(RRt	__stdin__RtmsvcrttputchtgetchtKeyboardInterrupt(RR R+tctpw((s/usr/lib64/python2.7/getpass.pytwin_getpassYs$

	



cCs?tjdtdd�|s(tj}n|dIJt||�S(Ns%Can not control echo on the terminal.t
stacklevelis&Warning: Password input may be echoed.(twarningstwarnRRRR(RR ((s/usr/lib64/python2.7/getpass.pyRps
R)cCs�|stj}n|s$tj}nt|�}|rP|j|�|j�n|j�}|skt�n|ddkr�|d }n|S(Ni����s
(RRRtstrRRtreadlinetEOFError(RR Rtline((s/usr/lib64/python2.7/getpass.pyRys

	
cCs\ddl}x*dD]"}|jj|�}|r|SqWddl}|j|j��dS(	s�Get the username from the environment or password database.

    First try various environment variables, then the password
    database.  This works on Windows as long as USERNAME is set.

    i����NtLOGNAMEtUSERtLNAMEtUSERNAMEi(R9R:R;R<(Rtenvirontgettpwdtgetpwuidtgetuid(RtnametuserR?((s/usr/lib64/python2.7/getpass.pyR�s
(tAskPassword(t__doc__RRR3t__all__tUserWarningRRR(R1RRRRRRtImportErrorRR+tEasyDialogsRDR(((s/usr/lib64/python2.7/getpass.pyt<module>s,$?