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: //proc/self/root/lib/python3/dist-packages/keyring/__pycache__/core.cpython-38.pyc
U

ܦ�\��@s�dZddlZddlZddlZddlmZmZddlmZddl	m
Z
ddlmZ
ddlmZe�e�Zdad	d
�Zdd�Zd
d�Zdd�Zdd�Zdd�Zdd�Zdd�Zd%dd�Zdd�Zdd�Zdd �Zd!d"�Z d#d$�Z!e�dS)&z1
Core API functions and initialization routines.
�N�)�configparser�filter)�max��backend)�	platform_)�failcCst|tj�std��|adS)z!Set current keyring backend.
    z0The keyring must be a subclass of KeyringBackendN)�
isinstancerZKeyringBackend�	TypeError�_keyring_backend)�keyring�r�./usr/lib/python3/dist-packages/keyring/core.py�set_keyringsrcCstS)z!Get current keyring backend.
    )rrrrr�get_keyringsrc	Cs�t��}zt�|�Wntk
r*YnXtj�|d�}tj�|�r\djft	��}t
|��t|d��}|�d�W5QRXdS)z4
    Configure the null keyring as the default.
    �
keyringrc.cfgz Refusing to overwrite {filename}�wz7[backend]
default-keyring=keyring.backends.null.KeyringN)
�platform�config_root�os�makedirs�OSError�path�join�exists�format�locals�RuntimeError�open�write)�root�filename�msg�filerrr�disable%sr%cCst�||�S)z-Get password from the specified service.
    )r�get_password��service_name�usernamerrrr&6sr&cCst�|||�dS)z8Set password for the user in the specified service.
    N)r�set_password)r(r)Zpasswordrrrr*<sr*cCst�||�dS)z?Delete the password for the user in the specified service.
    N)r�delete_passwordr'rrrr+Bsr+cCst�||�S)z0Get a Credential for the specified service.
    )r�get_credentialr'rrrr,Hsr,cCs
|jdkS)Nr)�priorityrrrr�recommendedNsr.cCs<|t_t|t���}tt�p4t�p4t|t�	�tj
d��dS)z�
    Load a keyring specified in the config file or infer the best available.

    Limit, if supplied, should be a callable taking a backend and returning
    True if that backend should be included for consideration.
    )�default�keyN)rZ_limitrZget_all_keyringr�load_env�load_configrr	ZKeyringZby_priority)�limitZkeyringsrrr�init_backendRs��r4cCs,|�d�\}}}t|�tj|}t||�S)aF
    Load the keyring class indicated by name.

    These popular names are tested to ensure their presence.

    >>> popular_names = [
    ...      'keyring.backends.Windows.WinVaultKeyring',
    ...      'keyring.backends.OS_X.Keyring',
    ...      'keyring.backends.kwallet.DBusKeyring',
    ...      'keyring.backends.SecretService.Keyring',
    ...  ]
    >>> list(map(_load_keyring_class, popular_names))
    [...]

    These legacy names are retained for compatibility.

    >>> legacy_names = [
    ...  ]
    >>> list(map(_load_keyring_class, legacy_names))
    [...]
    �.)�
rpartition�
__import__�sys�modules�getattr)�keyring_nameZmodule_name�sep�
class_name�modulerrr�_load_keyring_classfs
r?cCst|�}|j|�S)z�
    Load the specified keyring by name (a fully-qualified name to the
    keyring, such as 'keyring.backends.file.PlaintextKeyring')
    )r?r-)r;Zclass_rrr�load_keyring�sr@cCs*zttjd�WStk
r$YnXdS)z6Load a keyring configured in the environment variable.ZPYTHON_KEYRING_BACKENDN)r@r�environ�KeyErrorrrrrr1�sr1c	Cs�d}tj�t��|�}tj�|�s&dSt��}|�|�t	|�z,|�
d�r^|�dd���}nt�
dd��Wn8tj
tfk
r�t�d�}|�dd|�YdSXt|�S)z8Load a keyring using the config file in the config root.rNrzdefault-keyringr
z/Keyring config file contains incorrect values.
zConfig file: %s)rrrrrrrZRawConfigParser�read�_load_keyring_pathZhas_section�get�strip�
NoOptionError�ImportError�logging�	getLoggerZwarningr@)r"Zkeyring_cfg�configr;Zloggerrrrr2�s$


�r2c	CsDz"|�dd���}tj�d|�Wntjtjfk
r>YnXdS)z)load the keyring-path option (if present)rzkeyring-pathrN)rErFr8r�insertrrG�NoSectionError)rKrrrrrD�s
rD)N)"�__doc__rr8rIZ
py27compatrrZ
py33compatr�r�utilrrZbackendsr	rJ�__name__�logrrrr%r&r*r+r,r.r4r?r@r1r2rDrrrr�<module>s2