™N ϊωΒ6csXdZ dd„Z9dd„ZNdd„ZRdd„Zad„ZdS( sUtilities to get a password and/or the current user name. getpass(prompt) - prompt for a password, with echo turned off getuser() - get the user name from the environment or password database Authors: Piers Lauder (original) Guido van Rossum (Windows support and cleanup) c s k}y|iiƒ}Wnt|ƒSnXyk}k}Wntj oy  k }WnZ!tj oK"y#k l Wn#$tj o%t|ƒSnX'||ƒSnX)t |ƒSnX+|i |ƒ},|}.|d|i@|d</z,0|i||i|ƒ1t|ƒ} Wd23|i||i|ƒX5|iidƒ6| SdS(sσPrompt for a password, with echo turned off. Restore terminal settings at end. On Windows, this calls win_getpass(prompt) which uses the msvcrt module to get the same effect. On the Mac EasyDialogs.AskPassword is used, if available. iNs (ssyssstdinsfilenosfdsdefault_getpassspromptstermiossTERMIOSs ImportErrorsmsvcrts EasyDialogss AskPasswords win_getpasss tcgetattrsoldsnewsECHOs tcsetattrs TCSADRAINs _raw_inputspasswdsstdoutswrite( spromptssyssfdstermiossTERMIOSsmsvcrts AskPasswordsoldsnewspasswds%R:\Python\Intel\V1.5.2\Lib\getpass.pysgetpass s8    s Password: cs9:;k}<x#|d<r}=|i|ƒqW>d}?x?do„@|iƒ}A|djp |djoBPnC|djo Dt‚nE|djoF|d }nH||}qGWI|idƒJ|idƒK|SdS( s9Prompt for password with echo off, using Windows getch().isis s ssN(smsvcrtspromptscsputchspwsgetchsKeyboardInterrupt(spromptsmsvcrtscspws%R:\Python\Intel\V1.5.2\Lib\getpass.pys win_getpass9s&     csNOt|ƒSdS(N(s _raw_inputsprompt(sprompts%R:\Python\Intel\V1.5.2\Lib\getpass.pysdefault_getpassNscs˜RUk}Vt|ƒ}W|oX|ii|ƒnY|iiƒ}Z| o [t‚n\|d djo]|d }n^|SdS(Nis ( ssyssstrspromptsstdoutswritesstdinsreadlineslinesEOFError(spromptssysslines%R:\Python\Intel\V1.5.2\Lib\getpass.pys _raw_inputRs    scs…agik}kxIddddfdkr0}l|ii|ƒ}m|o n|Snq'Wqk}r|i|iƒƒdSdS(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. sLOGNAMEsUSERsLNAMEsUSERNAMEiN(sossnamesenvironsgetsuserspwdsgetpwuidsgetuid(sossnamesuserspwds%R:\Python\Intel\V1.5.2\Lib\getpass.pysgetuseras    N(s__doc__sgetpasss win_getpasssdefault_getpasss _raw_inputsgetuser(s%R:\Python\Intel\V1.5.2\Lib\getpass.pys?s .