o
    D©Ìh  ã                   @   sô   d dl m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ƒZG dd„ deƒZ	G dd„ deƒZ
G dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZdS ) é    )Údefaultdict)ÚNotRegisteredÚInvalidDocumentErrorÚLookUpErrorÚDoesNotExistÚMultipleObjectsReturnedÚInvalidQueryErrorÚOperationErrorÚNotUniqueErrorÚBulkWriteErrorÚFieldDoesNotExistÚValidationErrorÚSaveConditionErrorÚDeprecatedErrorc                   @   ó   e Zd ZdS )ÚMongoEngineExceptionN©Ú__name__Ú
__module__Ú__qualname__© r   r   úa/var/www/html/Moveonwheels/move_on_wheels/venv/lib/python3.10/site-packages/mongoengine/errors.pyr      ó    r   c                   @   r   )r   Nr   r   r   r   r   r      r   r   c                   @   r   )r   Nr   r   r   r   r   r      r   r   c                   @   r   )r   Nr   r   r   r   r   r       r   r   c                   @   r   )r   Nr   r   r   r   r   r   $   r   r   c                   @   r   )r   Nr   r   r   r   r   r   (   r   r   c                   @   r   )r   Nr   r   r   r   r   r   ,   r   r   c                   @   r   )r	   Nr   r   r   r   r   r	   0   r   r	   c                   @   r   )r
   Nr   r   r   r   r   r
   4   r   r
   c                   @   r   )r   Nr   r   r   r   r   r   8   r   r   c                   @   r   )r   Nr   r   r   r   r   r   <   r   r   c                   @   ó   e Zd ZdZdS )r   a  Raised when trying to set a field
    not declared in a :class:`~mongoengine.Document`
    or an :class:`~mongoengine.EmbeddedDocument`.

    To avoid this behavior on data loading,
    you should set the :attr:`strict` to ``False``
    in the :attr:`meta` dictionary.
    N©r   r   r   Ú__doc__r   r   r   r   r   @   s    r   c                       st   e Zd ZdZi ZdZdZd‡ fdd„	Zdd„ Zdd	„ Z	‡ fd
d„Z
dd„ Zdd„ ZeeeƒZdd„ Zdd„ Z‡  ZS )r   a  Validation exception.

    May represent an error validating a field or a
    document containing fields with validation errors.

    :ivar errors: A dictionary of errors for fields within this
        document or list, or None if the error is for an
        individual field.
    NÚ c                    s0   t ƒ  |¡ | di ¡| _| d¡| _|| _d S )NÚerrorsÚ
field_name)ÚsuperÚ__init__Úgetr   r   Úmessage)Úselfr"   Úkwargs©Ú	__class__r   r   r    Z   s   
zValidationError.__init__c                 C   s
   t | jƒS ©N)Ústrr"   ©r#   r   r   r   Ú__str__`   ó   
zValidationError.__str__c                 C   s   | j j› d| j› d�S )Nú(z,))r&   r   r"   r)   r   r   r   Ú__repr__c   s   zValidationError.__repr__c                    s@   t ƒ  |¡}|dkr| jrd| }| jr|› d|  ¡ › d�}|S )Nr"   z%sr,   ú))r   Ú__getattribute__r   r   Ú_format_errors)r#   Únamer"   r%   r   r   r/   f   s   z ValidationError.__getattribute__c                 C   s   | j S r'   ©Ú_messager)   r   r   r   Ú_get_messageo   s   zValidationError._get_messagec                 C   s
   || _ d S r'   r2   )r#   r"   r   r   r   Ú_set_messager   r+   zValidationError._set_messagec                    s    ‡ fdd„‰ | j si S ˆ | j ƒS )zìReturns a dictionary of all errors within a document

        Keys are field names or list indices and values are the
        validation error messages, or a nested dictionary of
        errors for an embedded document or list.
        c                    sR   i }t | tƒr|  ¡ D ]
\}}ˆ |ƒ||< q|S t | tƒr%| jr%ˆ | jƒS t| ƒS r'   )Ú
isinstanceÚdictÚitemsr   r   r(   )ÚsourceÚerrors_dictr   Úerror©Ú
build_dictr   r   r=      s   
û
z+ValidationError.to_dict.<locals>.build_dict)r   r)   r   r<   r   Úto_dictw   s   
zValidationError.to_dictc                    sV   d‡ fdd„	‰ t tƒ}|  ¡  ¡ D ]\}}|ˆ |ƒ  |¡ qd dd„ | ¡ D ƒ¡S )	z5Returns a string listing all errors within a documentr   c                    sh   t | tƒrd ‡ fdd„| D ƒ¡} nt | tƒr%d ‡ fdd„|  ¡ D ƒ¡} |r0|› d| › �}|S | }|S )Nú c                    s   g | ]}ˆ |ƒ‘qS r   r   )Ú.0Úk©Úgenerate_keyr   r   Ú
<listcomp>•   s    zHValidationError._format_errors.<locals>.generate_key.<locals>.<listcomp>c                    s   g | ]	\}}ˆ ||ƒ‘qS r   r   ©r@   rA   ÚvrB   r   r   rD   —   s    Ú.)r6   ÚlistÚjoinr7   r8   )ÚvalueÚprefixÚresultsrB   r   r   rC   “   s   

ÿz4ValidationError._format_errors.<locals>.generate_keyr?   c                 S   s   g | ]\}}|› d |› �‘qS )z: r   rE   r   r   r   rD   Ÿ   s    z2ValidationError._format_errors.<locals>.<listcomp>N©r   )r   rH   r>   r8   ÚappendrI   )r#   Ú
error_dictrA   rF   r   rB   r   r0   �   s
   	zValidationError._format_errorsrM   )r   r   r   r   r   r   r3   r    r*   r-   r/   r4   r5   Úpropertyr"   r>   r0   Ú__classcell__r   r   r%   r   r   K   s    
	
r   c                   @   r   )r   z9Raise when a user uses a feature that has been DeprecatedNr   r   r   r   r   r   ¢   s    r   N)Úcollectionsr   Ú__all__Ú	Exceptionr   r   r   ÚAttributeErrorr   r   r   r   r	   r
   r   r   r   ÚAssertionErrorr   r   r   r   r   r   Ú<module>   s     W