HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/docker/credentials/__pycache__/store.cpython-310.pyc
o

�2.a��@sZddlZddlZddlZddlmZddlmZddlmZddlmZGdd�d�Z	dS)	�N�)�	constants)�errors)�create_environment_dict)�find_executablec@s>eZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�ZdS)�StoreNcCs>tj||_t|j�|_||_|jdurt�d�|j���dS)z� Create a store object that acts as an interface to
            perform the basic operations for storing, retrieving
            and erasing credentials using `program`.
        N�){} not installed or not available in PATH)	r�PROGRAM_PREFIX�programr�exe�environmentr�InitializationError�format)�selfr
r�r�:/usr/lib/python3/dist-packages/docker/credentials/store.py�__init__s
���zStore.__init__cCs^t|t�s
|�d�}|�d|�}t�|�d��}|ddkr-|ddkr-t�d|j	����|S)zt Retrieve credentials for `server`. If no credentials are found,
            a `StoreError` will be raised.
        �utf-8�get�Username��SecretzNo matching credentials in )
�
isinstance�bytes�encode�_execute�json�loads�decoder�CredentialsNotFoundr
)r�server�data�resultrrrrs


�z	Store.getcCs$t�|||d���d�}|�d|�S)z_ Store credentials for `server`. Raises a `StoreError` if an error
            occurs.
        )�	ServerURLrrr�store)r�dumpsrr)rr �username�secret�
data_inputrrrr$/s��zStore.storecCs$t|t�s
|�d�}|�d|�dS)z_ Erase credentials for `server`. Raises a `StoreError` if an error
            occurs.
        r�eraseN)rrrr)rr rrrr):s

zStore.erasecCs|�dd�}t�|�d��S)zB List stored credentials. Requires v0.4.0+ of the helper.
        �listNr)rrrr)rr!rrrr*Bsz
Store.listc
Cs�d}t|j�}ztj|j|g||d�}W|Stjy)}zt�||j��d}~wt	yN}z|j
t
jkr?t�d�
|j���t�d�
|j|j
���d}~ww)N)�input�envrz"Unexpected OS error "{}", errno={})rr�
subprocess�check_outputr�CalledProcessErrorr�process_store_errorr
�OSError�errno�ENOENT�
StoreErrorr�strerror)r�subcmdr(�outputr,�errrrHs0
���������zStore._execute)N)	�__name__�
__module__�__qualname__rrr$r)r*rrrrrrs
r)
r2rr-rrr�utilsrrrrrrr�<module>s