a _æhfã @sÔdZddlZddlZddlZddlZddlZgd¢ZGdd„deƒZddd„Z dd d „Z dd d „Z ddd„Z dd„Z zddlZejejfWn>eefyÊz ddlZWneyÀe ZYn0e ZYn0e 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. éN)ÚgetpassÚgetuserÚGetPassWarningc@s eZdZdS)rN)Ú__name__Ú __module__Ú __qualname__©rrú(/opt/imh-python/lib/python3.9/getpass.pyrórú Password: c CsÐd}t ¡¬}zJt dtjtjB¡}t |d¡}| |¡t  |¡}| |¡|sX|}Wn^t y¸|  ¡zt j  ¡}Wn$ttfy¢d}t||ƒ}Yn0t j }|s´t j}Yn0|duržzšt |¡}|dd…}|dtjM<tj} ttdƒr | tjO} z6t || |¡t|||d}Wt || |¡| ¡nt || |¡| ¡0Wn>tjyœ|dur|‚||urŽ|  ¡t||ƒ}Yn0| d¡|WdƒS1sÂ0YdS)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ÚstreamÚpasswdÚstackÚfdZttyrÚoldÚnewZtcsetattr_flagsrrr Ú unix_getpasssV             ÿ   r2cCsŒtjtjurt||ƒS|D]}t |¡qd}t ¡}|dkst|dkrHqt|dkrTt‚|dkrj|dd…}q.||}q.t d¡t d¡|S)z:Prompt for password with echo off, using Windows getwch().Úú rúúNéÿÿÿÿ)rrÚ __stdin__r!ÚmsvcrtZputwchZgetwchÚKeyboardInterrupt)r+r,ÚcZpwrrr Ú win_getpassas       r<cCs0tjdtdd|stj}td|dt||ƒS)Nz%Can not control echo on the terminal.é)Ú stacklevelz&Warning: Password input may be echoed.)Úfile)ÚwarningsÚwarnrrr"Úprintr')r+r,rrr r!xsÿ r!r3cCsš|s tj}|stj}t|ƒ}|rnz| |¡Wn6tyd| |jd¡}| |j¡}| |¡Yn0|  ¡|  ¡}|s~t ‚|ddkr–|dd…}|S)NÚreplacer7r) rr"rÚstrr*ÚUnicodeEncodeErrorÚencodeÚencodingÚdecoder(ÚreadlineÚEOFError)r+r,rÚlinerrr r's&    r'cCs<dD]}tj |¡}|r|Sqddl}| t ¡¡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. )ZLOGNAMEZUSERZLNAMEÚUSERNAMErN)rÚenvironÚgetÚpwdÚgetpwuidÚgetuid)ÚnameÚuserrOrrr ršs   r)r N)r N)r N)r3NN)Ú__doc__rrrrr@Ú__all__Ú UserWarningrr2r<r!r'rr#r$r&Ú ImportErrorrr9rrrrr Ús, D