o
    È³ªg	  ã                   @  st   d Z ddlmZ ddlZdZG dd„ deƒZG dd„ deƒZG d	d
„ d
eƒZ	G dd„ dee
ƒZG d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   r   úR/var/www/html/chatdoc2/venv/lib/python3.10/site-packages/marshmallow/exceptions.pyr      ó    r   c                      s@   e Zd ZdZeddfd‡ fdd„Zdd„ Zeddd„ƒZ‡  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ÚdataúYtyping.Mapping[str, typing.Any] | typing.Iterable[typing.Mapping[str, typing.Any]] | NoneÚ
valid_dataú:list[dict[str, typing.Any]] | dict[str, typing.Any] | Nonec                   sB   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__r   r   r      s   
zValidationError.__init__c                 C  s(   | j tkrt| jtƒr| jS | j | jiS r   )r   ÚSCHEMAr   r   Údict©r   r   r   r   Únormalized_messages-   s   z#ValidationError.normalized_messagesÚreturnúdict[str, typing.Any]c                 C  s&   t | jtƒstdt| jƒj ƒ‚| jS )Nz9cannot access 'messages_dict' when 'messages' is of type )r   r   r"   Ú	TypeErrorÚtyper   r#   r   r   r   Úmessages_dict2   s   
ÿÿzValidationError.messages_dict)r   r   r   r   r   r   r   r   )r%   r&   )
r   r   r	   r
   r!   r   r$   Úpropertyr)   Ú__classcell__r   r   r   r   r      s    ùr   c                   @  r   )ÚRegistryErrorzXRaised when an invalid operation is performed on the serializer
    class registry.
    Nr   r   r   r   r   r,   <   r   r,   c                   @  r   )ÚStringNotCollectionErrorzBRaised when a string is passed when a list of strings is expected.Nr   r   r   r   r   r-   B   r   r-   c                   @  r   )ÚFieldInstanceResolutionErrorzLRaised when schema to instantiate is neither a Schema class nor an instance.Nr   r   r   r   r   r.   F   r   r.   )r
   Ú
__future__r   Útypingr!   Ú	Exceptionr   r   Ú	NameErrorr,   r'   r-   r.   r   r   r   r   Ú<module>   s    -