AlkantarClanX12

Your IP : 3.147.86.246


Current Path : /opt/alt/python34/lib64/python3.4/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/__pycache__/getpass.cpython-34.pyc

�
e f��@s4dZddlZddlZddlZddlZddlZdddgZGdd�de�Zdddd	�Z	ddd
d�Z
dddd
�Zddddd�Zdd�Z
y ddlZejejfWnIeefk
r)yddlZWnek
reZYnXe
ZYnXe	ZdS)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.

�N�getpass�getuser�GetPassWarningc@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�,/opt/alt/python34/lib64/python3.4/getpass.pyrsz
Password: c.Cs5d}tj��}yjtjdtjtjB�}tj|d�}|j|�tj	|�}|j|�|s~|}nWn�t
k
r}zm|j�ytj
j�}Wn-ttfk
r�d}t||�}YnXtj
}|s�tj}nWYdd}~XnX|dk	ry�tj|�}|dd�}	|	dtjM<tj}
ttd�rw|
tjO}
nz,tj||
|	�t||d|�}Wdtj||
|�|j�XWqtjk
r|dk	r��n||k	r|j�nt||�}YqXn|jd�|SWdQXdS)aPrompt 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+��TCSASOFT�input�
)�
contextlib�	ExitStack�os�open�O_RDWR�O_NOCTTY�io�FileIO�
enter_context�
TextIOWrapper�OSError�close�sys�stdin�fileno�AttributeError�
ValueError�fallback_getpass�stderr�termios�	tcgetattrZECHOZ	TCSAFLUSH�hasattrr�	tcsetattr�
_raw_input�flush�error�write)�prompt�streamZpasswd�stack�fdZttyr�e�old�newZtcsetattr_flagsrrr	�unix_getpasssR



		

r0cCs�tjtjk	rt||�Sddl}x|D]}|j|�q2Wd}xj|j�}|dksv|dkrzPn|dkr�t�n|dkr�|dd	�}qR||}qRW|jd�|jd�|S)
z9Prompt for password with echo off, using Windows getch().rN��
r
������)rr�	__stdin__r�msvcrtZputwchZgetwch�KeyboardInterrupt)r)r*r8�cZpwrrr	�win_getpassbs$

	

r;cCsEtjdtdd�|s(tj}ntdd|�t||�S)Nz%Can not control echo on the terminal.�
stacklevel�z&Warning: Password input may be echoed.�file)�warnings�warnrrr �printr%)r)r*rrr	rysrr1cCs�|stj}n|s$tj}nt|�}|r�y|j|�WnFtk
r�|j|jd�}|j|j�}|j|�YnX|j	�n|j
�}|s�t�n|ddkr�|dd�}n|S)N�replacer5r
r6r6)rr r�strr(�UnicodeEncodeError�encode�encoding�decoder&�readline�EOFError)r)r*r�linerrr	r%�s&

	r%cCsPx*dD]"}tjj|�}|r|SqWddl}|jtj��dS)z�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.

    �LOGNAME�USER�LNAME�USERNAMErN)rKrLrMrN)r�environ�get�pwd�getpwuid�getuid)�name�userrQrrr	r�s
)�__doc__rrrrr?�__all__�UserWarningrr0r;rr%rr!r"r$�ImportErrorrr8rrrrr	�<module>s,D