%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3/dist-packages/certbot/plugins/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3/dist-packages/certbot/plugins/__pycache__/storage.cpython-312.pyc

�

M/�e����dZddlZddlZddlmZddlmZddlmZddlmZddl	m
Z
ddl	mZeje
�ZGd	�d
�Zy)zPlugin storage class.�N)�Any)�Dict)�
configuration)�errors)�
filesystem)�osc�t�eZdZdZdej
deddfd�Zdd�Zdd�Z	dd	�Z
d
ededdfd�Zd
edefd
�Z
y)�
PluginStoragez4Class implementing storage functionality for plugins�config�classkey�returnNc�6�||_||_d|_||y)z�Initializes PluginStorage object storing required configuration
        options.

        :param .configuration.NamespaceConfig config: Configuration object
        :param str classkey: class name to use as root key in storage file

        FN)�_config�	_classkey�_initialized)�selfrrs   �9/usr/lib/python3/dist-packages/certbot/plugins/storage.py�__init__zPluginStorage.__init__s �����!���!�����c��tjj|jjd�|_|j
�d|_y)zhInitializes PluginStorage data and reads current state from the disk
        if the storage json exists.z.pluginstorage.jsonTN)r�path�joinr�
config_dir�_storagepath�_loadr)rs r�_initialize_storagez!PluginStorage._initialize_storage!s7���G�G�L�L����)@�)@�BW�X����
�
�� ��rc���i}d}	t|jd�5}|j�}ddd�	tj|�}||_y#1swY�'xYw#t$r�}dj	|jt|��}tjj|j�r*tj|�tj|��Yd}~��d}~wwxYw#t$rr|s!tj!d|j�nEdj	|j�}tj|�tj|��Y||_ywxYw)z�Reads PluginStorage content from the disk to a dict structure

        :raises .errors.PluginStorageError: when unable to open or read the file
        ��rNz1Could not read PluginStorage data file: {0} : {1}z2Plugin storage file %s was empty, no values loadedz$PluginStorage file {0} is corrupted.)�openr�read�IOError�format�strrr�isfile�logger�errorr�PluginStorageError�json�loads�
ValueError�debug�_data)r�data�filedata�fh�e�errmsgs      rrzPluginStorage._load)s9��
 "����		8��d�'�'��-�
%���7�7�9��
%�
	8��:�:�h�'�D���
�)
%�
%���	8�H�O�O��!�!�3�q�6�+�F��w�w�~�~�d�/�/�0����V�$��/�/��7�7�1��	8���	8�����Q�!�.�.�0�@�F�F��%�%�'�����V�$��/�/��7�7�
0���
�	8�s@�A�A�A�C-�A�A�	C*�(A8C%�%C*�-A1E(�'E(c�6�|js,d}tj|�tj|��	tj|j�}	tjtj|jtj tj"ztj$zd�d�5}|j'|�ddd�y#t$rI}djt|��}tj|�tj|��d}~wwxYw#1swYyxYw#t($rT}dj|jt|��}tj|�tj|��d}~wwxYw)z�Saves PluginStorage content to disk

        :raises .errors.PluginStorageError: when unable to serialize the data
            or write it to the filesystem
        z;Unable to save, no values have been added to PluginStorage.z+Could not serialize PluginStorage data: {0}Ni��wz4Could not write PluginStorage data to file {0} : {1})rr&r'rr(r)�dumpsr-�	TypeErrorr#r$r�fdopenrr r�O_WRONLY�O_CREAT�O_TRUNC�writer")rr2�
serializedr1r0s     r�savezPluginStorage.saveGsJ��� � �R�F��L�L�� ��+�+�F�3�3�	4����D�J�J�/�J�
	4����:�?�?��%�%��K�K�"�*�*�,�r�z�z�9��� �!�
%�%'�����$�	
%�
%��
�	4�B�I�I��A���F��L�L�� ��+�+�F�3�3��		4��
%�
%��
�	4�K�R�R��!�!�3�q�6�+�F��L�L�� ��+�+�F�3�3��		4�sP�C�A%D;�?D/�D;�	D,�#AD'�'D,�/D8�4D;�8D;�;	F�AF�F�key�valuec���|js|j�|j|jvri|j|j<||j|j|<y)z�Put configuration value to PluginStorage

        :param str key: Key to store the value to
        :param value: Data to store
        N)rrrr-)rr>r?s   r�putzPluginStorage.putesR��� � ��$�$�&��>�>����+�)+�D�J�J�t�~�~�&�*/��
�
�4�>�>�"�3�'rc�r�|js|j�|j|j|S)z�Get configuration value from PluginStorage

        :param str key: Key to get value from the storage

        :raises KeyError: If the key doesn't exist in the storage
        )rrr-r)rr>s  r�fetchzPluginStorage.fetchrs1��� � ��$�$�&��z�z�$�.�.�)�#�.�.r)r
N)�__name__�
__module__�__qualname__�__doc__r�NamespaceConfigr$rrrr=rrArC�rrr
r
sb��>�
�}�<�<�
��
�PT�
�!��<4�<0�s�0�3�0�4�0�
/��
/��
/rr
)rGr)�logging�typingrr�certbotrr�certbot.compatrr�	getLoggerrDr&r
rIrr�<module>rOs>�������!��%��	��	�	�8�	$��m/�m/r

Zerion Mini Shell 1.0