%PDF- %PDF-
Mini Shell

Mini Shell

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

�

�e���v�UdZddlmZddlZddlZddlZddlZddlZddlZddl	m
Z
ddlmZm
Z
mZddlmZej"e�Zej(d�ZdZd	ed
<Gd�dej0�ZGd
�de��ZGd�d�ZGd�de�Zdd�Zej<dd��ZGd�d�Z y)z 
Keyring implementation support
�)�annotationsN�)�metadata)�credentials�errors�util)�
properties�priorityz8typing.Optional[typing.Callable[[KeyringBackend], bool]]�_limitc�"��eZdZdZ�fd�Z�xZS)�KeyringBackendMetazn
    A metaclass that's both an ABCMeta and a type that keeps a registry of
    all (non-abstract) types.
    c���t�|�|||�t|d�st�|_|j}|j
s|j
|�yy)N�_classes)�super�__init__�hasattr�setr�__abstractmethods__�add)�cls�name�bases�dict�classes�	__class__s     ��1/usr/lib/python3/dist-packages/keyring/backend.pyrzKeyringBackendMeta.__init__ sJ���
����u�d�+��s�J�'��5�C�L��,�,���&�&��K�K���'�)�__name__�
__module__�__qualname__�__doc__r�
__classcell__)rs@rr
r
s����
�rr
c� �eZdZdZd�Zejdd��Zejd��Ze					dd��Z
ejdd��Zdd�Ze
jdd��Ze
jdd	��Zdd
�Z						dd�Zdd�Zdd
�Zy)�KeyringBackendz]The abstract base class of the keyring, every backend must implement
    this interface.
    c�$�|j�y�N)�set_properties_from_env��selfs rrzKeyringBackend.__init__.s���$�$�&rc��t�)a�
        Each backend class must supply a priority, a number (float or integer)
        indicating the priority of the backend relative to all other backends.
        The priority need not be static -- it may (and should) vary based
        attributes of the environment in which is runs (platform, available
        packages, etc.).

        A higher number indicates a higher priority. The priority should raise
        a RuntimeError with a message indicating the underlying cause if the
        backend is not suitable for the current environment.

        As a rule of thumb, a priority between zero but less than one is
        suitable, but a priority of one or greater is recommended.
        )�NotImplementedErrorr(s rr
zKeyringBackend.priority1s
�� "�!rc�v�tj�5}|jddd�|S#1swYSxYwr&)r�ExceptionRaisedContextr
)r�excs  r�viablezKeyringBackend.viableCs5��
�
*�
*�
,�	���L�L�	��w��	��w��s�
-�8c�T�ttjd�|j�S)z6
        Return all subclasses deemed viable.
        r/)�filter�operator�
attrgetterr)rs r�get_viable_backendsz"KeyringBackend.get_viable_backendsIs ���h�)�)�(�3�S�\�\�B�Brc��|jjd�\}}}|jdd�}dj||jg�S)zr
        The keyring name, suitable for display.

        The name is derived from module and class name.
        �.�_� )r�
rpartition�replace�joinr)r�parent�sep�mod_names    rrzKeyringBackend.nameRsI��!$��� 9� 9�#� >����X��#�#�C��-���x�x��3�<�<�0�1�1rc�z�t|�}dj|j|j|j�S)Nz{}.{} (priority: {:g}))�type�formatrrr
)r)�
keyring_classs  r�__str__zKeyringBackend.__str__]s7���T�
�
�'�.�.��$�$�m�&<�&<�m�>T�>T�
�	
rc��y)z,Get password of the username for the serviceN��r)�service�usernames   r�get_passwordzKeyringBackend.get_passwordcs��rc�,�tjd��)z�Set password for the username of the service.

        If the backend cannot store passwords, raise
        PasswordSetError.
        �reason)r�PasswordSetError�r)rGrH�passwords    r�set_passwordzKeyringBackend.set_passwordhs���%�%�h�/�/rc�,�tjd��)z�Delete the password for the username of the service.

        If the backend cannot delete passwords, raise
        PasswordDeleteError.
        rK)r�PasswordDeleteErrorrFs   r�delete_passwordzKeyringBackend.delete_passwordts���(�(��2�2rc�\�|�*|j||�}|�tj||�Sy)aGets the username and password for the service.
        Returns a Credential instance.

        The *username* argument is optional and may be omitted by
        the caller or ignored by the backend. Callers must use the
        returned username.
        N)rIr�SimpleCredentialrMs    r�get_credentialzKeyringBackend.get_credentials8�����(�(��(�;�H��#�"�3�3�H�h�G�G�rc��dd�}tdt|tjj	���}|D]\}}t|||��y)z6For all KEYRING_PROPERTY_* env var, set that property.c�b�|\}}|jd�\}}}|xr|j�|fS)N�KEYRING_PROPERTY_)�	partition�lower)�item�key�value�prer=rs      r�parsez5KeyringBackend.set_properties_from_env.<locals>.parse�s6���J�C�� �]�]�+>�?�N�C��d��0�D�J�J�L�%�0�0rN)r[ztyping.Tuple[str, str])r1�map�os�environ�items�setattr)r)r_�propsrr]s     rr'z&KeyringBackend.set_properties_from_env�sM��	1�
17��#�e�R�Z�Z�-�-�/�0�1
��!�	'�K�D�%��D�$��&�	'rc�d�tj|�}t|�j|�|Sr&)�copy�vars�update)r)�kwargs�alts   r�with_propertieszKeyringBackend.with_properties�s&���i�i��o���S�	���� ��
rN)�return�float)rztyping.Type[KeyringBackend]rmz#filter[typing.Type[KeyringBackend]])rm�str)rGrorHrorm�typing.Optional[str])rGrorHrorNrorm�None)rGrorHrormrq)rGrorHrprmz'typing.Optional[credentials.Credential]�rmrq)rj�
typing.Anyrmr$)rrr r!rr	�
classpropertyr
r/�classmethodr4rrC�abc�abstractmethodrIrOrRrUr'rlrErrr$r$)s����'����"��"�"������
�C�
(�C�	,�C��C����2��2�
�	������	���0��0�3����'��
1�	�&'�rr$)�	metaclassc�X�eZdZdZej
d��Zej
d��Zy)�Crypterz.Base class providing encryption and decryptionc��y)zEncrypt the value.NrE�r)r]s  r�encryptzCrypter.encrypt����	
rc��y)zDecrypt the value.NrEr|s  r�decryptzCrypter.decrypt�r~rN)rrr r!rvrwr}r�rErrrzrz�s7��8����
��
�	���
��
rrzc��eZdZdZd�Zd�Zy)�NullCrypterzA crypter that does nothingc��|Sr&rEr|s  rr}zNullCrypter.encrypt�����rc��|Sr&rEr|s  rr�zNullCrypter.decrypt�r�rN)rrr r!r}r�rErrr�r��s��%��rr�c��tjd��D]E}	tjd|j�|j�}t
|�r|��Gy#t$rtjd|�d��Y�mwxYw)a�
    Locate all setuptools entry points by the name 'keyring backends'
    and initialize them.
    Any third-party library may register an entry point by adding the
    following to their setup.cfg::

        [options.entry_points]
        keyring.backends =
            plugin_name = mylib.mymodule:initialize_func

    `plugin_name` can be anything, and is only used to display the name
    of the plugin at initialization time.

    `initialize_func` is optional, but will be invoked if callable.
    zkeyring.backends)�groupz
Loading %szError initializing plugin r6N)	r�entry_points�log�debugr�load�callable�	Exception�	exception)�ep�	init_funcs  r�
_load_pluginsr��sv�� �#�#�*<�=�>��	>��I�I�l�B�G�G�,����	�I��	�"����>���	>��M�M�6�r�d�!�<�=�	>�s�AA � "B�Bc��t�tj�}tj|t
��}t
|�S)zc
    Return a list of all implemented keyrings that can be constructed without
    parameters.
    )�
exceptions)r�r$r4r�suppress_exceptions�	TypeError�list)�viable_classes�ringss  r�get_all_keyringr��s3���O�#�7�7�9�N��$�$�^�	�J�E���;�rc�b�eZdZdZdZeedd��edd����Z	d							dd
�Zy	)
�SchemeSelectablea
    Allow a backend to select different "schemes" for the
    username and service.

    >>> backend = SchemeSelectable()
    >>> backend._query('contoso', 'alice')
    {'username': 'alice', 'service': 'contoso'}
    >>> backend._query('contoso')
    {'service': 'contoso'}
    >>> backend.scheme = 'KeePassXC'
    >>> backend._query('contoso', 'alice')
    {'UserName': 'alice', 'Title': 'contoso'}
    >>> backend._query('contoso', 'alice', foo='bar')
    {'UserName': 'alice', 'Title': 'contoso', 'foo': 'bar'}
    �defaultrHrG)rHrG�UserName�Title)r��	KeePassXCNc�r�|j|j}t|�|d||d|in|d|ifi|��S)NrHrG)�schemes�schemer)r)rGrH�baser�s     r�_queryzSchemeSelectable._query�sa�����d�k�k�*���
�#��z�"�H��y�!�7�
��y�!�7��

��

�
	
rr&)rGrorHrpr�rsrmztyping.Dict[str, str])rrr r!r�rr�r�rErrr�r��sW��� �F���j�)�<��
�G�<��G�>B�
��
�&:�
�KU�
�	�
rr�rr)rmztyping.List[KeyringBackend])!r!�
__future__rrarv�loggingr2rg�typing�py312compatr�rrr�_compatr	�	getLoggerrr�r3�by_priorityr�__annotations__�ABCMetar
r$rzr�r��oncer�r�rErr�<module>r�s����#�	�
����
�!�'�'���g����!��"�h�!�!�*�-��CG��@�G������z�1�z�z
�
��'��>�4������%
�%
r

Zerion Mini Shell 1.0