a
    ¡˜ëjŒ	  ã                   @   s2   d Z ddlmZ G dd„ dƒZdd„ Zdd„ Zd	S )
z¦Utilities 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   úV/mnt/bigstor/www/usecases/.venv/lib/python3.9/site-packages/marshmallow/error_store.pyÚ__init__   s    zErrorStore.__init__Nc                 C   sD   t |ƒ}|tkst|tƒs"||i}|d ur2||i}t| j|ƒ| _d S r   )Úcopy_containersr   Ú
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   s8   t | tƒrdd„ | D ƒS t | tƒr4dd„ |  ¡ D ƒS | S )Nc                 S   s   g | ]}t |ƒ‘qS r   ©r   )Ú.0Úvalr   r   r	   Ú
<listcomp>   ó    z#copy_containers.<locals>.<listcomp>c                 S   s   i | ]\}}|t |ƒ“qS r   r   )r   Úkeyr   r   r   r	   Ú
<dictcomp>!   r   z#copy_containers.<locals>.<dictcomp>)r   Úlistr   Úitemsr   r   r   r	   r      s
    

r   c                 C   s  | s|S |s| S t | tƒrbt |tƒr2|  |¡ | S t |tƒrTt| | t¡ƒ|t< |S |  |¡ | S t | tƒrÈt |tƒr°| ¡ D ],\}}|| v r¢t| | |ƒ| |< q~|| |< q~| S t|  t¡|ƒ| t< | S t |tƒrÜ| g|¢S t |tƒrþt| | t¡ƒ|t< |S | |gS )z¬Deeply merge two error messages.

    The format of ``errors1`` and ``errors2`` matches the ``message``
    parameter of :exc:`marshmallow.exceptions.ValidationError`.
    )	r   r   Úextendr   r   Úgetr   Úappendr   )Zerrors1Zerrors2r   r   r   r   r	   r   %   s8    










r   N)Ú__doc__Zmarshmallow.exceptionsr   r   r   r   r   r   r   r	   Ú<module>   s   