Ë
    òT•jf  ã                   óö   — d Z ddlZddlZddlZddlZddlZg d¢Z G d„ de«      Zdd„Z	dd„Z
dd„Zdd	„Zd
„ Z	 ddlZej                  ej                   f e	Zy# eef$ r 	 ddlZe
ZY y# e$ r eZY Y yw xY ww xY w)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                   ó   — e Zd Zy)r   N)Ú__name__Ú
__module__Ú__qualname__© ó    ú/usr/lib/python3.12/getpass.pyr   r      s   … r   r   c                 óÞ  — d}t        j                  «       5 }	 t        j                  dt        j                  t        j
                  z  «      }t        j                  |d«      }|j                  |«       t        j                  |«      }|j                  |«       |s|}|�¸	 t'        j(                  |«      }|dd }|dxx   t&        j*                   z  cc<   t&        j,                  }	t/        t&        d«      r|	t&        j0                  z  }		 t'        j2                  ||	|«       t5        | ||¬«      }t'        j2                  ||	|«       |j7                  «        	 |j;                  d«       |cddd«       S # t        $ ry |j                  «        	 t        j                  j                  «       }n## t        t         f$ r d}t#        | |«      }Y nw xY wt        j                  }|st        j$                  }Y �ŒWw xY w# t'        j2                  ||	|«       |j7                  «        w xY w# t&        j8                  $ r' |�‚ ||ur|j                  «        t#        | |«      }Y �Œw xY w# 1 sw Y   yxY w)a  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.
    Nz/dev/ttyzw+é   Ú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Ú	tcgetattrÚECHOÚ	TCSAFLUSHÚhasattrr   Ú	tcsetattrÚ
_raw_inputÚflushÚerrorÚwrite)
ÚpromptÚstreamÚpasswdÚstackÚfdÚttyr   ÚoldÚnewÚtcsetattr_flagss
             r   Úunix_getpassr8      s  € ð €FÜ	×	Ñ	Ó	ð 1 5ð	$ä—‘˜¤R§Y¡Y¬r¯{©{Ñ%:Ó;ˆBÜ—)‘)˜B Ó%ˆCØ×Ñ Ô$Ü×$Ñ$ SÓ)ˆEØ×Ñ Ô&ÙØ�ð ˆ>ð:Ü×'Ñ'¨Ó+�Ø™!�f�Ø�A“œ7Ÿ<™<˜-Ñ'“Ü")×"3Ñ"3�Üœ7 JÔ/Ø#¤w×'7Ñ'7Ñ7�Oð#Ü×%Ñ% b¨/¸3Ô?Ü'¨°¸eÔD�Fä×%Ñ% b¨/¸3Ô?Ø—L‘L•Nð 	�‰�TÔØ÷c1ñ 1øô ò 
	$à�K‰KŒMð:Ü—Y‘Y×%Ñ%Ó'‘øÜ"¤JÐ/ò :Ø�Ü)¨&°&Ó9’ð:úô —I‘IˆEÙÜŸ™�úð
	$ûô0 ×%Ñ% b¨/¸3Ô?Ø—L‘L•NûÜ—=‘=ò 
:ØÐ%ð ð  Ñ&à—K‘K”MÜ)¨&°&Ó9“ð
:ú÷I1ð 1ús�   —I#™BE5ÂI#Â"A)H&Ä%G:Ä1'H&ÅI#Å5G7ÆF.Æ-G7Æ.GÇG7ÇGÇ%G7Ç3I#Ç6G7Ç7I#Ç:)H#È#H&È&6I ÉI#ÉI É I#É#I,c                 óf  — t         j                  t         j                  urt        | |«      S | D ]  }t	        j
                  |«       Œ d}	 t	        j                  «       }|dk(  s|dk(  rn|dk(  rt        ‚|dk(  r|dd }n||z   }Œ;t	        j
                  d«       t	        j
                  d«       |S )z:Prompt for password with echo off, using Windows getwch().Ú úr   úúNéÿÿÿÿ)r   r   Ú	__stdin__r#   ÚmsvcrtÚputwchÚgetwchÚKeyboardInterrupt)r/   r0   ÚcÚpws       r   Úwin_getpassrF   a   s©   € ä
‡y�yœŸ™Ñ%Ü ¨Ó/Ð/àò ˆÜ�‰�aÕðà	€BØ
Ü�M‰M‹OˆØ�Š9˜˜Tš	ØØ�Š;Ü#Ð#Ø�Š9Ø�C�R�‰Bà�a‘ˆBð ô ‡M�M�$ÔÜ
‡M�M�$ÔØ€Ir   c                 ó�   — t        j                  dt        d¬«       |st        j                  }t        d|¬«       t        | |«      S )Nz%Can not control echo on the terminal.é   )Ú
stacklevelz&Warning: Password input may be echoed.)Úfile)ÚwarningsÚwarnr   r   r$   Úprintr+   )r/   r0   s     r   r#   r#   x   s:   € Ü‡M�MÐ9¼>Øõ áÜ—‘ˆÜ	Ð
2¸Õ@Ü�f˜fÓ%Ð%r   c                 ó¤  — |st         j                  }|st         j                  }t        | «      } | r"	 |j	                  | «       |j                  «        |j                  «       }|st        ‚|d   dk(  r|d d }|S # t
        $ rK | j                  |j                  d«      } | j                  |j                  «      } |j	                  | «       Y ŒŠw xY w)NÚreplacer>   r   )r   r$   r   Ústrr.   ÚUnicodeEncodeErrorÚencodeÚencodingÚdecoder,   ÚreadlineÚEOFError)r/   r0   r   Úlines       r   r+   r+   �   sµ   € áÜ—‘ˆÙÜ—	‘	ˆÜ�‹[€FÙð	!Ø�L‰L˜Ô ð 	�‰Œà�>‰>Ó€DÙÜˆØˆB�x�4ÒØ�C�RˆyˆØ€Køô "ò 	!à—]‘] 6§?¡?°IÓ>ˆFØ—]‘] 6§?¡?Ó3ˆFØ�L‰L˜Ö ð		!ús   ³A; Á;ACÃCc                  ó®   — dD ]'  } t         j                  j                  | «      }|sŒ%|c S  ddl}|j	                  t        j
                  «       «      d   S )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ÚUSERNAMEr   N)r   ÚenvironÚgetÚpwdÚgetpwuidÚgetuid)ÚnameÚuserr_   s      r   r   r   š   sL   € ð 9ò ˆÜ�z‰z�~‰~˜dÓ#ˆÚØŠKðó Ø�<‰<œŸ	™	›Ó$ QÑ'Ð'r   )z
Password: N)r:   NN)Ú__doc__r   r   r   r   rK   Ú__all__ÚUserWarningr   r8   rF   r#   r+   r   r%   r&   r*   r   ÚImportErrorr!   r@   r
   r   r   ú<module>rh      s¥   ðñ
ó  Û 	Û 	Û 
Û â
0€ô (�[Ô 'óAóHó.&óò2(ð$Ûð ×Ñ�w×(Ñ(Ñ(ð �Gøð 	�^Ð$ò ðÛð Šøð ò #Ø"‹ð#úðús/   ºA ÁA8Á!A)Á%A8Á)A4Á0A8Á3A4Á4A8