CasperSecurity

Current Path : /lib/python3/dist-packages/keyring/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/keyring/__pycache__/backend.cpython-310.pyc

o

���a��@s�dZddlZddlZddlZddlZddlmZddlZddl	m
Z
mZmZddlm
Z
e�e�Ze�d�ZdZGdd	�d	ej�ZGd
d�ded�ZGd
d�d�ZGdd�de�Zdd�Zejdd��ZdS)z 
Keyring implementation support
�N)�Optional�)�credentials�errors�util)�
properties�prioritycs eZdZdZ�fdd�Z�ZS)�KeyringBackendMetazn
    A metaclass that's both an ABCMeta and a type that keeps a registry of
    all (non-abstract) types.
    cs@t��|||�t|d�st�|_|j}|js|�|�dSdS)N�_classes)�super�__init__�hasattr�setr
�__abstractmethods__�add)�cls�name�bases�dict�classes��	__class__��1/usr/lib/python3/dist-packages/keyring/backend.pyrs
�zKeyringBackendMeta.__init__)�__name__�
__module__�__qualname__�__doc__r�
__classcell__rrrrr	sr	c	@s�eZdZdZdd�Zdd�Zejedd���Z	edd	��Z
ejed
d���Zdd
�Ze
jdededeefdd��Ze
jdedededdfdd��Zdededdfdd�Zdedeedeejfdd�Zdd�ZdS)�KeyringBackendz]The abstract base class of the keyring, every backend must implement
    this interface.
    cCs|��dS�N)�set_properties_from_env)�selfrrrr,szKeyringBackend.__init__cC�dS)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.
        Nr�rrrrr0szKeyringBackend.prioritycCs8t���
}|jWd�|S1swY|Sr )r�ExceptionRaisedContextr)r�excrrr�viable@s

��zKeyringBackend.viablecCstt�d�|j�S)z6
        Return all subclasses deemed viable.
        r')�filter�operator�
attrgetterr
r$rrr�get_viable_backendsGsz"KeyringBackend.get_viable_backendscCs.|j�d�\}}}|�dd�}d�||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_namerrrrNszKeyringBackend.namecCst|�}d�|j|j|j�S)Nz{}.{} (priority: {:g}))�type�formatrrr)r"�
keyring_classrrr�__str__Zs�zKeyringBackend.__str__�service�username�returncCr#)z,Get password of the username for the serviceNr�r"r9r:rrr�get_password`�zKeyringBackend.get_password�passwordNcC�
t�d��)z�Set password for the username of the service.

        If the backend cannot store passwords, raise
        PasswordSetError.
        �reason)r�PasswordSetError�r"r9r:r?rrr�set_passwordes
zKeyringBackend.set_passwordcCr@)z�Delete the password for the username of the service.

        If the backend cannot delete passwords, raise
        PasswordDeleteError.
        rA)r�PasswordDeleteErrorr<rrr�delete_passwordqs
zKeyringBackend.delete_passwordcCs,|dur|�||�}|durt�||�SdS)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)r=r�SimpleCredentialrCrrr�get_credential|s

zKeyringBackend.get_credentialcCs<dd�}tdt|tj����}|D]
\}}t|||�qdS)z6For all KEYRING_PROPERTY_* env var, set that property.cSs(|\}}|�d�\}}}|o|��|fS)N�KEYRING_PROPERTY_)�	partition�lower)�item�key�value�prer3rrrr�parse�sz5KeyringBackend.set_properties_from_env.<locals>.parseN)r(�map�os�environ�items�setattr)r"rP�propsrrNrrrr!�s
�z&KeyringBackend.set_properties_from_env)rrrrrrr�
ClassProperty�classmethodr'r+rr8�abc�abstractmethod�strrr=rDrFr�
CredentialrHr!rrrrr's4

��
�r)�	metaclassc@s,eZdZdZejdd��Zejdd��ZdS)�Crypterz.Base class providing encryption and decryptioncCr#)zEncrypt the value.Nr�r"rNrrr�encrypt�r>zCrypter.encryptcCr#)zDecrypt the value.Nrr_rrr�decrypt�r>zCrypter.decryptN)rrrrrYrZr`rarrrrr^�s
r^c@s eZdZdZdd�Zdd�ZdS)�NullCrypterzA crypter that does nothingcC�|Sr rr_rrrr`��zNullCrypter.encryptcCrcr rr_rrrra�rdzNullCrypter.decryptN)rrrrr`rarrrrrb�srbc	Csbtjdd�D](}zt�d|j�|��}t|�r|�Wqty.t�d|�d��YqwdS)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 r,N)	�metadata�entry_points�log�debugr�load�callable�	Exception�	exception)�ep�	init_funcrrr�
_load_plugins�s���rpcCs$t�t��}tj|td�}t|�S)zc
    Return a list of all implemented keyrings that can be constructed without
    parameters.
    )�
exceptions)rprr+r�suppress_exceptions�	TypeError�list)�viable_classes�ringsrrr�get_all_keyring�srw)rrRrY�loggingr)�typingr�importlib_metadatarf�rrrr�	getLoggerrrhr*�by_priority�_limit�ABCMetar	rr^rbrp�oncerwrrrr�<module>s&

u

Hacker Blog, Shell İndir, Sql İnjection, XSS Attacks, LFI Attacks, Social Hacking, Exploit Bot, Proxy Tools, Web Shell, PHP Shell, Alfa Shell İndir, Hacking Training Set, DDoS Script, Denial Of Service, Botnet, RFI Attacks, Encryption
Telegram @BIBIL_0DAY