o
    ȳg                     @   s*   d Z ddlmZ G dd dZdd ZdS )zUtilities for storing collections of error messages.

.. warning::

    This module is treated as private API.
    Users should not need to use this module directly.
    )SCHEMAc                   @   s"   e Zd Zdd ZedfddZdS )
ErrorStorec                 C   s
   i | _ d S N)errors)self r   S/var/www/html/chatdoc2/venv/lib/python3.10/site-packages/marshmallow/error_store.py__init__   s   
zErrorStore.__init__Nc                 C   s<   |t ks	t|ts||i}|d ur||i}t| j|| _d S r   )r   
isinstancedictmerge_errorsr   )r   messages
field_nameindexr   r   r   store_error   s
   zErrorStore.store_error)__name__
__module____qualname__r	   r   r   r   r   r   r   r      s    r   c              	   C   sH  | s|S |s| S t | tr1t |tr| | S t |tr+t|fi tt| |tiS g | |S t | trt |trKt| fi tt| t|iS t |trqt| }| D ]\}}||v rjt|| |||< qX|||< qX|S t| fi tt| t|iS t |tr| g|S t |trt|fi tt| |tiS | |gS )zDeeply merge two error messages.

    The format of ``errors1`` and ``errors2`` matches the ``message``
    parameter of :exc:`marshmallow.exceptions.ValidationError`.
    )r
   listr   r   r   getitems)errors1errors2r   keyvalr   r   r   r      s4   


 

 

 


 r   N)__doc__marshmallow.exceptionsr   r   r   r   r   r   r   <module>   s    