
    &`i                     f    d dl mZ d dlmZ d dlmZmZ d dlm	Z	 d dl
mZ dZ G d de          ZdS )	    )OptionalN)binary_to_hexhex_to_binary)Preprocessor)
Checkpointpreprocessor_pklc                   6    e Zd ZdZdee         fdZdefdZdS )FrameworkCheckpointa  A checkpoint to preserve the functionality of legacy
    framework-specific checkpoints.

    Example:

        >>> import tempfile
        >>> checkpoint = FrameworkCheckpoint(tempfile.mkdtemp())
        >>> checkpoint.get_preprocessor() is None
        True
        >>> preprocessor = Preprocessor()
        >>> preprocessor._attr = 1234
        >>> checkpoint.set_preprocessor(preprocessor)
        >>> checkpoint.get_preprocessor()._attr
        1234
    returnc                     |                                  }|                    t                    }|dS t          j        t          |                    S )zReturn the preprocessor stored in the checkpoint.

        Returns:
            The preprocessor stored in the checkpoint, or ``None`` if no
            preprocessor was stored.
        N)get_metadatagetPREPROCESSOR_KEY
ray_pickleloadsr   )selfmetadatapreprocessor_bytess      |/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/ray/train/_internal/framework_checkpoint.pyget_preprocessorz$FrameworkCheckpoint.get_preprocessor   sM     $$&&%\\*:;;%4.@ A ABBB    preprocessorc                 |    |                      t          t          t          j        |                    i           dS )z)Store a preprocessor with the checkpoint.N)update_metadatar   r   r   dumps)r   r   s     r   set_preprocessorz$FrameworkCheckpoint.set_preprocessor)   s?    }Z-=l-K-KLLM	
 	
 	
 	
 	
r   N)__name__
__module____qualname____doc__r   r   r   r    r   r   r
   r
      s^          C(<"8 C C C C
\ 
 
 
 
 
 
r   r
   )typingr   ray.cloudpicklecloudpickler   ray._common.utilsr   r   ray.data.preprocessorr   ray.train._checkpointr   r   r
   r!   r   r   <module>r(      s          $ $ $ $ $ $ : : : : : : : : . . . . . . , , , , , ,% "
 "
 "
 "
 "
* "
 "
 "
 "
 "
r   