관리-도구
편집 파일: serialization.cpython-311.pyc
� IMg� � � � d dl Z d dlZd dlZd dlmZ d dlmZmZ ej e � � Z d� Zdedefd�Z dd�ded eeef fd �ZdS )� N)�iscoroutinefunction)�Union�Callablec � � t | d� � 5 }t j ||� � d d d � � d S # 1 swxY w Y d S )N�wb)�open�pickle�dump)�path�obj�ws �X/opt/imunify360/venv/lib/python3.11/site-packages/defence360agent/utils/serialization.py�_dumpr s� � � �d�D� � � �Q���C������ � � � � � � � � � � ���� � � � � � s �4�8�8r �attrc � � �� �� fd�}|S )z� Make decorator to serialize an object or object's attribute :param path: path to file to serialize into :param attr: attribute name to serialize c � �� � t j � � � �� �fd�� � }t j � � � �� �fd�� � }t � � � r|S |S )Nc � �� �| g|�R i |��}t | �� � }t � d|�� � t �|� � |S �NzWrite %r to %r��getattr�logger�debugr ��self�args�kwargs�resultr r �fr s ���r �wrapperz2serialize_attr.<locals>.decorator.<locals>.wrapper s] �� ��Q�t�-�d�-�-�-�f�-�-�F��$��%�%�C��L�L�)�3��5�5�5��$������M� c � � �K � �| g|�R i |��� d {V ��}t | �� � }t � d|�� � t �|� � |S r r r s ���r � async_wrapperz8serialize_attr.<locals>.decorator.<locals>.async_wrapper ss �� � � ��1�T�3�D�3�3�3�F�3�3�3�3�3�3�3�3�F��$��%�%�C��L�L�)�3��5�5�5��$������Mr )� functools�wrapsr )r r r"