관리-도구
편집 파일: getpass.cpython-33.pyo
� ��f� c @ 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( u� 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 Nu getpassu getuseru GetPassWarningc B s | Ee Z d Z d S( u GetPassWarningN( u __name__u __module__u __qualname__( u __locals__( ( u, /opt/alt/python33/lib64/python3.3/getpass.pyu GetPassWarning s u Password: c . C s5 d } t j � �} yj t j d t j t j B� } t j | d � } | j | � t j | � } | j | � | s~ | } n Wn� t k r} zm | j � y t j j � } Wn- t t f k r� d } t | | � } Yn Xt j } | s� t j } n WYd d } ~ Xn X| d k ry� t j | � } | d d � } | d t j M<t j } t t d � rw| t j O} n z, t j | | | � t | | d | �} Wd t j | | | � | j � XWqt j k r| d k r�� n | | k r| j � n t | | � } YqXn | j d � | SWd QXd S( u 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. u /dev/ttyu w+Ni u TCSASOFTu inputu ( u Noneu contextlibu ExitStacku osu openu O_RDWRu O_NOCTTYu iou FileIOu enter_contextu TextIOWrapperu OSErroru closeu sysu stdinu filenou AttributeErroru ValueErroru fallback_getpassu stderru termiosu tcgetattru ECHOu TCSAFLUSHu hasattru TCSASOFTu tcsetattru _raw_inputu flushu erroru write( u promptu streamu passwdu stacku fdu ttyu inputu eu oldu newu tcsetattr_flags( ( u, /opt/alt/python33/lib64/python3.3/getpass.pyu unix_getpass sR u unix_getpassc C s� t j t j k r t | | � Sd d l } x | D] } | j | � q2 Wd } xi | j � } | d k sv | d k rz Pn | d k r� t � n | d k r� | d d � } qR | | } qR | j d � | j d � | S( u9 Prompt for password with echo off, using Windows getch().i Nu u u u u i i����( u sysu stdinu __stdin__u fallback_getpassu msvcrtu putwchu getwchu KeyboardInterrupt( u promptu streamu msvcrtu cu pw( ( u, /opt/alt/python33/lib64/python3.3/getpass.pyu win_getpassb s$ u win_getpassc C sE t j d t d d �| s( t j } n t d d | �t | | � S( Nu% Can not control echo on the terminal.u stackleveli u&