
    6|h	                        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y)z1Exception classes for marshmallow-related errors.    )annotationsN_schemac                      e Zd ZdZy)MarshmallowErrorz.Base class for all marshmallow-related errors.N__name__
__module____qualname____doc__     U/var/www/html/test/engine/venv/lib/python3.12/site-packages/marshmallow/exceptions.pyr   r      s    8r   r   c                  R     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.
    Nc                    t        |t        t        f      r|gn|| _        || _        || _        || _        || _        t        | %  |       y N)

isinstancestrbytesmessages
field_namedata
valid_datakwargssuper__init__)selfmessager   r   r   r   	__class__s         r   r   zValidationError.__init__   sF     &0#u%F	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-   s8    ??f$DMM4)H== //r   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   sC    $--.Kt}}%../  }}r   )r   zstr | list | dictr   r   r   zYtyping.Mapping[str, typing.Any] | typing.Iterable[typing.Mapping[str, typing.Any]] | Noner   z:list[dict[str, typing.Any]] | dict[str, typing.Any] | None)returnzdict[str, typing.Any])
r   r	   r
   r   r!   r   r$   propertyr(   __classcell__)r   s   @r   r   r      sZ    
 ! QU""" "	" O""0
  r   r   c                      e Zd ZdZy)RegistryErrorzXRaised when an invalid operation is performed on the serializer
    class registry.
    Nr   r   r   r   r-   r-   <   s    r   r-   c                      e Zd ZdZy)StringNotCollectionErrorzBRaised when a string is passed when a list of strings is expected.Nr   r   r   r   r/   r/   B   s    Lr   r/   c                      e Zd ZdZy)FieldInstanceResolutionErrorzLRaised when schema to instantiate is neither a Schema class nor an instance.Nr   r   r   r   r1   r1   F   s    Vr   r1   )r   
__future__r   typingr!   	Exceptionr   r   	NameErrorr-   r&   r/   r1   r   r   r   <module>r6      s]    7 "  
9y 9*& *ZI M/ MW#3Y Wr   