
    &`ib                     B     G d  de           Zi ZdedefdZdefdZdS )c                   (     e Zd ZdZdef fdZ xZS )UnknownPreprocessorErrorzPRaised when attempting to deserialize an unknown/unregistered preprocessor type.preprocessor_typec                 ^    || _         t                                          d|            d S )NzUnknown preprocessor type: )r   super__init__)selfr   	__class__s     z/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/ray/data/preprocessors/version_support.pyr   z!UnknownPreprocessorError.__init__   s3    !2J7HJJKKKKK    )__name__
__module____qualname____doc__strr   __classcell__)r	   s   @r
   r   r      sU        ZZL# L L L L L L L L L Lr   r   version
identifierc                       fd}|S )aO  Register a preprocessor class for serialization.

    This decorator registers a preprocessor class in the serialization registry,
    enabling it to be serialized and deserialized. The decorated class MUST inherit
    from SerializablePreprocessor.

    Args:
        version: Version number for this preprocessor's serialization format
        identifier: Stable identifier for serialization. This identifier will be used
            in serialized data. Using an explicit identifier allows classes to be
            renamed without breaking compatibility with existing serialized data.

    Returns:
        A decorator function that registers the class and returns it unchanged.

    Raises:
        TypeError: If the decorated class does not inherit from SerializablePreprocessor

    Note:
        If a class with the same identifier is already registered, logs an info message
        and overwrites the previous registration.

    Examples:
        @SerializablePreprocessor(version=1, identifier="my_preprocessor_v1")
        class MyPreprocessor(SerializablePreprocessor):
            pass
    c                    dd l }ddlm} t          | |          s t	          d| j         d| j         d          |                                |                                t          v rLt                   }|| k    r9|
                    d d|j         d|j         d| j         d| j         d           | t          <   | S )	N    )SerializablePreprocessorBasezClass .zW must inherit from SerializablePreprocessor to use @SerializablePreprocessor decorator.zPreprocessor id collision: 'z' was already registered by z. Overwriting with )loggingray.data.preprocessorr   
issubclass	TypeErrorr   r   set_versionset_preprocessor_class_id_PREPROCESSOR_REGISTRYinfo)clsr   r   existingr   r   s       r
   	decoratorz+SerializablePreprocessor.<locals>.decorator)   sD   FFFFFF #;<< 	X X X#*: X X X  
 	   %%j111 ///-j9H3M: M M"-M M080EM M(+M M9<9IM M M   .1z*
r    )r   r   r#   s   `` r
   SerializablePreprocessorr%      s*    :     8 r   serialization_idc                 L    | t           vrt          |           t           |          S )a9  Look up a preprocessor class by its serialization ID.

    Args:
        serialization_id: The serialization ID of the preprocessor (either explicit or class name)

    Returns:
        The registered preprocessor class

    Raises:
        UnknownPreprocessorError: If the serialization ID is not registered
    )r   r   )r&   s    r
   _lookup_classr(   H   s+     555&'7888!"233r   N)
ValueErrorr   r   intr   r%   r(   r$   r   r
   <module>r+      s   L L L L Lz L L L  9c 9s 9 9 9 9x4C 4 4 4 4 4 4r   