
    Ng	                        d Z ddlmZ ddlZdZ G d de          Z G d de          Z G d	 d
e          Z	 G d dee
          Z G d dee
          ZdS )z1Exception classes for marshmallow-related errors.    )annotationsN_schemac                      e Zd ZdZdS )MarshmallowErrorz.Base class for all marshmallow-related errors.N__name__
__module____qualname____doc__     R/var/www/html/ai-engine/env/lib/python3.11/site-packages/marshmallow/exceptions.pyr   r      s        8888r   r   c                  J     e Zd ZdZeddfd fdZd Zedd            Z xZ	S )ValidationErrora  Raised when validation fails on a field or schema.

    Validators and custom fields should raise this exception.

    :param message: An error message, list of error messages, or dict of
        error messages. If a dict, the keys are subitems and the values are error messages.
    :param field_name: Field name to store the error on.
        If `None`, the error is stored as schema-level error.
    :param data: Raw input data.
    :param valid_data: Valid (de)serialized data.
    Nmessagestr | list | dict
field_namestrdataYtyping.Mapping[str, typing.Any] | typing.Iterable[typing.Mapping[str, typing.Any]] | None
valid_data:list[dict[str, typing.Any]] | dict[str, typing.Any] | Nonec                    t          |t          t          f          r|gn|| _        || _        || _        || _        || _        t                      	                    |           d S N)

isinstancer   bytesmessagesr   r   r   kwargssuper__init__)selfr   r   r   r   r   	__class__s         r   r    zValidationError.__init__   s_     &0#u%F%FS		G$	$!!!!!r   c                    | j         t          k    r!t          | j        t                    r| j        S | j         | j        iS r   )r   SCHEMAr   r   dictr!   s    r   normalized_messagesz#ValidationError.normalized_messages-   s7    ?f$$DM4)H)H$= //r   returndict[str, typing.Any]c                    t          | j        t                    s)t          dt	          | j                  j        z             | j        S )Nz9cannot access 'messages_dict' when 'messages' is of type )r   r   r%   	TypeErrortyper   r&   s    r   messages_dictzValidationError.messages_dict2   sJ    $-.. 	Kt}%%./   }r   )r   r   r   r   r   r   r   r   )r(   r)   )
r   r	   r
   r   r$   r    r'   propertyr-   __classcell__)r"   s   @r   r   r      s        
 
 ! QU" " " " " " ""0 0 0
    X    r   r   c                      e Zd ZdZdS )RegistryErrorzXRaised when an invalid operation is performed on the serializer
    class registry.
    Nr   r   r   r   r1   r1   <   s           r   r1   c                      e Zd ZdZdS )StringNotCollectionErrorzBRaised when a string is passed when a list of strings is expected.Nr   r   r   r   r3   r3   B   s        LLLLr   r3   c                      e Zd ZdZdS )FieldInstanceResolutionErrorzLRaised when schema to instantiate is neither a Schema class nor an instance.Nr   r   r   r   r5   r5   F   s        VVVVr   r5   )r   
__future__r   typingr$   	Exceptionr   r   	NameErrorr1   r+   r3   r5   r   r   r   <module>r:      s#   7 7 " " " " " "  
9 9 9 9 9y 9 9 9* * * * *& * * *Z    I   M M M M M/ M M MW W W W W#3Y W W W W Wr   