
    &`i                         d dl Z d dlmZ d dlmZmZ edededefd            Z	edefd            Z
e G d d	                      ZdS )
    N)DeveloperAPI	PublicAPIcls
serializerdeserializerc                    t           j        j        j                                        }|                    | ||           dS )a  Use the given serializer to serialize instances of type ``cls``,
    and use the deserializer to deserialize the serialized object.

    Args:
        cls: A Python class/type.
        serializer: A function that converts an instances of
            type ``cls`` into a serializable object (e.g. python dict
            of basic objects).
        deserializer: A function that constructs the
            instance of type ``cls`` from the serialized object.
            This function itself must be serializable.
    N)ray_privateworkerglobal_workerget_serialization_context _register_cloudpickle_serializer)r   r   r   contexts       j/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/ray/util/serialization.pyregister_serializerr      s;     l!/IIKKG,,S*lKKKKK    c                     t           j        j        j                                        }|                    |            dS )zDeregister the serializer associated with the type ``cls``.
    There is no effect if the serializer is unavailable.

    Args:
        cls: A Python class/type.
    N)r	   r
   r   r   r   _unregister_cloudpickle_reducer)r   r   s     r   deregister_serializerr      s7     l!/IIKKG++C00000r   c                        e Zd Zd Zd Zd ZdS )StandaloneSerializationContextc                 .    |t           j        j        |<   d S NpickleCloudPicklerdispatch)selfr   reducers      r   _register_cloudpickle_reducerz<StandaloneSerializationContext._register_cloudpickle_reducer*   s    ,3$S)))r   c                 P    t           j        j                            |d            d S r   )r   r   r   pop)r   r   s     r   r   z>StandaloneSerializationContext._unregister_cloudpickle_reducer-   s$    $((d33333r   c                 >    fd}|t           j        j        |<   d S )Nc                       |           ffS r    )objcustom_deserializercustom_serializers    r   _CloudPicklerReducerz]StandaloneSerializationContext._register_cloudpickle_serializer.<locals>._CloudPicklerReducer3   s    &):):3)?)?(AAAr   r   )r   r   r(   r'   r)   s     `` r   r   z?StandaloneSerializationContext._register_cloudpickle_serializer0   sA    	B 	B 	B 	B 	B 	B -A$S)))r   N)__name__
__module____qualname__r    r   r   r%   r   r   r   r   $   sF        4 4 44 4 4A A A A Ar   r   )r	   ray.cloudpicklecloudpickler   ray.util.annotationsr   r   typecallabler   r   r   r%   r   r   <module>r2      s    



             8 8 8 8 8 8 8 8 LT L( L( L L L L" 1t 1 1 1 1 A A A A A A A A A Ar   