HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/lib/python3/dist-packages/keyring/__pycache__/cli.cpython-38.pyc
U

ܦ�\��@s�dZddlmZddlZddlmZddlZddlmZddlm	Z	ddlm
Z
mZmZm
Z
eZGd	d
�d
�Zddd�Zed
kr�e�e��dS)z@Simple command line interface to get/set password from a keyring�)�print_functionN)�OptionParser�)�core)�backend)�set_keyring�get_password�set_password�delete_passwordc@sDeZdZdd�Zdd�Zdd�Zedd��Zed	d
��Z	dd�Z
d
S)�CommandLineToolcCs`tdd�|_|jjdddddd�|jjdd	d
ddd�|jjdd
dd�|jjdd
dd�dS)Nz$%prog [get|set|del] SERVICE USERNAME)Zusagez-pz--keyring-path�keyring_pathzPath to the keyring backend)�dest�default�helpz-bz--keyring-backend�keyring_backendzName of the keyring backendz--list-backends�
store_truezList keyring backends and exit)�actionrz	--disablezDisable keyring and exit)r�parserZ
add_option)�self�r�-/usr/lib/python3/dist-packages/keyring/cli.py�__init__s*�
�
���zCommandLineTool.__init__c
Cs�|j�|�\}}|jr0t��D]}t|�qdS|jrBt��dSz|\}}}Wn<tk
r�t	|�dkr||j�
�YdS|j�d�YnX|jdk	r�z*|j
r�tj�d|j
�tt�|j��Wn2tfk
r�t��d}|j�d|�YnX|dk�r&t||�}	|	dk�rdS|�|	�dS|dk�rR|�d||f�}	t|||	�dS|dk�r||�d	||f�}	t||�dS|j�d
�dS)NrrzWrong number of argumentsz$Unable to load specified keyring: %s�get�setzPassword for '%s' in '%s': �delz$Deleting password for '%s' in '%s': z.You can only 'get', 'del' or 'set' a password.)r�
parse_argsZ
list_backendsrZget_all_keyring�print�disabler�
ValueError�lenZ
print_help�errorrr�sys�path�insertrZload_keyring�	Exception�exc_infor�output_password�input_passwordr	r
)
r�argvZopts�args�kZkind�serviceZusername�e�passwordrrr�run#sZ







�
��
zCommandLineTool.runcCs|��pt�|�S)z&Retrieve password from input.
        )�pass_from_pipe�getpass)r�promptrrrr'aszCommandLineTool.input_passwordcCs tj��}|o|�tj���S)z=Return password from pipe if not on TTY, else False.
        )r!�stdin�isatty�strip_last_newline�read)�clsZis_piperrrr/fszCommandLineTool.pass_from_pipecCs|d|�d��S)z#Strip one last newline, if present.N�
)�endswith)�strrrrr4msz"CommandLineTool.strip_last_newlinecCst|tjd�dS)zbOutput the password to the user.

        This mostly exists to ease the testing process.
        )�fileN)rr!�stdout)rr-rrrr&rszCommandLineTool.output_passwordN)�__name__�
__module__�__qualname__rr.r'�classmethodr/�staticmethodr4r&rrrrrs>

rcCs&|dkrtjdd�}t�}|�|�S)zMain command line interface.Nr)r!r(rr.)r(Zclirrr�main{srA�__main__)N)�__doc__Z
__future__rr0Zoptparserr!�rrrrr	r
�typeZ
__metaclass__rrAr<�exitrrrr�<module>sj