관리-도구
편집 파일: persistent_state.cpython-311.opt-1.pyc
� IMg! � �x � d dl Z d dlmZ d dlmZ ee� � Z ed� � Zedz Zde de fd�Zd e fd �ZdS )� N)� getLogger)�Pathz/var/imunify360z.persistent_state� class_name�valuesc � � t } |� dd�� � || � d�z }t j ||� d� � � � dS # t t f$ r'}t � d| |� � Y d}~dS d}~ww xY w)z1Save state to a file in .persistent_state folder.T)�parents�exist_ok�.state�wzFailed to save state: %s %sN) �PERSISTENT_STATE_DIR�mkdir�json�dump�open�AttributeError�OSError�logger�error)r r �folder_path� file_path�es �\/opt/imunify360/venv/lib/python3.11/site-packages/defence360agent/subsys/persistent_state.py� save_stater s� � � '�K�C����$���6�6�6��Z�"7�"7�"7�7� �� �&�)�.�.��-�-�.�.�.�.�.���G�$� C� C� C����2�J��B�B�B�B�B�B�B�B�B�����C���s �AA �B �#B�B �returnc �> � t }|| � d�z }|� � � rm t j |� d� � � � S # t j t t f$ r&}t � d| |� � Y d}~nd}~ww xY wt � � S )z3Load state from a file in .persistent_state folder.r �rzFailed to load state: %s %sN)r �existsr �loadr �JSONDecodeErrorr �UnicodeDecodeErrorr r �dict)r r r r s r � load_stater"