%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/keyring/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/keyring/__pycache__/cli.cpython-312.pyc

�

�e ���dZddlZddlZddlZddlmZddlmZddlmZddlmZm	Z	m
Z
mZddlm
Z
Gd	�d
�Zd
d�Zedk(rej"e��yy)z@Simple command line interface to get/set password from a keyring�N�)�core)�backend)�
completion)�set_keyring�get_password�set_password�delete_password)�	platform_c�h�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Ze
d��Zed��Zy
)�CommandLineToolc�j�tj�|_|jjddddd��|jjddddd	��|jjd
dd�
�|jjddd�
�gd�|j_|jjd|jjd��|jjdd��|jjdd��tj|j�y)Nz-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)�get�set�del�diagnose�	operation�?)�choices�nargs�service)r�username)�argparse�ArgumentParser�parser�add_argument�_operationsr�install��selfs �-/usr/lib/python3/dist-packages/keyring/cli.py�__init__zCommandLineTool.__init__s.���-�-�/������ � �����.�	!�	
�	
��� � ���"��.�	!�	
�	
��� � ���1�	!�	
�
	
��� � ���3M�	!�	
�#D�������� � ���K�K�+�+��	!�	
�
	
��� � ���	!�	
�	
��� � ���	!�	
�	���4�;�;�'�c��|jj|�}t|�jt|��|jr%tj�D]
}t|��y|jrtj�y|jdk(r|j�y|j�|j�t|d|j��|j�}|�S)Nr�do_)r"�
parse_args�vars�update�
list_backendsr�get_all_keyring�print�disablerrr�_check_args�_load_spec_backend�getattr�
invalid_op)r'�argv�args�k�methods     r(�runzCommandLineTool.run7s����{�{�%�%�d�+���T�
���$�t�*�%�����,�,�.�
���a��
���<�<��L�L�N���>�>�Z�'��M�M�O���������!����T�^�^�$4�5�t���G���x�r*c��|jrB|j�|j�)|jj	|j�d��yyy)Nz requires service and username)rrrr"�errorr&s r(r4zCommandLineTool._check_argsMsE���>�>��|�|�#�t�}�}�'<����!�!�T�^�^�$4�4R�"S�T�(=�r*c�t�t|j|j�}|�td��t	|�y)Nr)rrr�
SystemExitr2�r'�passwords  r(�do_getzCommandLineTool.do_getRs-������d�m�m�<�����Q�-��
�h�r*c��|jd|j�d|j�d��}t|j|j|�y)NzPassword for 'z' in 'z': )�input_passwordrrr	rAs  r(�do_setzCommandLineTool.do_setXsB���&�&��T�]�]�O�6�$�,�,��s�C�
��	�T�\�\�4�=�=�(�;r*c�D�t|j|j�y�N)r
rrr&s r(�do_delzCommandLineTool.do_del^s������d�m�m�4r*c��tj�}|j�r
td|�n
td|d�tdt	j
��y)Nzconfig path:z(absent)z
data root:)r�_config_path�existsr2r�	data_root)r'�config_roots  r(rzCommandLineTool.diagnoseasE���'�'�)�������.�+�.��.�+�z�:�
�l�I�/�/�1�2r*c��|jjddj|jj��d��y)NzSpecify operation (z, z).)r"r>�joinr$r&s r(r7zCommandLineTool.invalid_opis3�������/��	�	�$�+�+�:Q�:Q�0R�/S�SU�V�Wr*c�F�|j�y	|jr*tjj	d|j�tt
j|j��y#tf$r(}|jjd|���Yd}~yd}~wwxYw)Nrz"Unable to load specified keyring: )rr�sys�path�insertrr�load_keyring�	Exceptionr"r>)r'�excs  r(r5z"CommandLineTool._load_spec_backendls������'��
	J�� � �������4�#4�#4�5���)�)�$�*>�*>�?�@���|�	J�
�K�K��� B�3�%�H�I�I��
	J�s�AA.�.
B �8B�B c�P�|j�xstj|�S)zRetrieve password from input.)�pass_from_pipe�getpass)r'�prompts  r(rEzCommandLineTool.input_password|s���"�"�$�?�����(?�?r*c��tjj�}|xr-|jtjj	��S)z4Return password from pipe if not on TTY, else False.)rR�stdin�isatty�strip_last_newline�read)�cls�is_pipes  r(rYzCommandLineTool.pass_from_pipe�s:���i�i�&�&�(�(���C�3�1�1�#�)�)�.�.�2B�C�Cr*c�H�t|jd�rdnd�}||S)z�Strip one last newline, if present.

        >>> CommandLineTool.strip_last_newline('foo')
        'foo'
        >>> CommandLineTool.strip_last_newline('foo\n')
        'foo'
        �
���N)�slice�endswith)�str�slcs  r(r_z"CommandLineTool.strip_last_newline�s$���#�,�,�t�,�B�$�7���3�x�r*N)�__name__�
__module__�__qualname__r)r<r4rCrFrIrr7r5rE�classmethodrY�staticmethodr_�r*r(r
r
sc��&(�P�,U�
�<�5�3�X�J� @��D��D�
�	��	r*r
c�b�|�tjdd}t�}|j|�S)zMain command line interface.Nr)rRr8r
r<)r8�clis  r(�mainrr�s.���|��x�x���|��
�
�C��7�7�4�=�r*�__main__rH)�__doc__rZr rR�rrrrrr	r
�utilrr
rrrj�exitror*r(�<module>rxsT��F���
����F�F��B�B�J��z���C�H�H�T�V��r*

Zerion Mini Shell 1.0