
    h                     H   d dl mZ dZ G d de      Z G d de      Z G d de      Z G d	 d
e      Z G d de      Z	 G d de      Z
 G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Zy)     )defaultdict)NotRegisteredInvalidDocumentErrorLookUpErrorDoesNotExistMultipleObjectsReturnedInvalidQueryErrorOperationErrorNotUniqueErrorBulkWriteErrorFieldDoesNotExistValidationErrorSaveConditionErrorDeprecatedErrorc                       e Zd Zy)MongoEngineExceptionN__name__
__module____qualname__     P/var/www/html/eduruby.in/venv/lib/python3.12/site-packages/mongoengine/errors.pyr   r          r   r   c                       e Zd Zy)r   Nr   r   r   r   r   r      r   r   r   c                       e Zd Zy)r   Nr   r   r   r   r   r      r   r   r   c                       e Zd Zy)r   Nr   r   r   r   r   r       r   r   r   c                       e Zd Zy)r   Nr   r   r   r   r   r   $   r   r   r   c                       e Zd Zy)r   Nr   r   r   r   r   r   (   r   r   r   c                       e Zd Zy)r	   Nr   r   r   r   r	   r	   ,   r   r   r	   c                       e Zd Zy)r
   Nr   r   r   r   r
   r
   0   r   r   r
   c                       e Zd Zy)r   Nr   r   r   r   r   r   4   r   r   r   c                       e Zd Zy)r   Nr   r   r   r   r   r   8   r   r   r   c                       e Zd Zy)r   Nr   r   r   r   r   r   <   r   r   r   c                       e Zd ZdZy)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   r   c                   p     e Zd ZdZi ZdZdZd fd	Zd Zd Z	 fdZ
d Zd Z eee      Zd	 Zd
 Z x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.
    Nc                     t         |   |       |j                  di       | _        |j                  d      | _        || _        y )Nerrors
field_name)super__init__getr*   r+   message)selfr/   kwargs	__class__s      r   r-   zValidationError.__init__Z   s9    !jj2. **\2r   c                 ,    t        | j                        S N)strr/   r0   s    r   __str__zValidationError.__str__`   s    4<<  r   c                 N    | j                   j                   d| j                   dS )N(z,))r2   r   r/   r6   s    r   __repr__zValidationError.__repr__c   s$    ..))*!DLL><<r   c                     t         |   |      }|dk(  r3| j                  rd|z  }| j                  r| d| j	                          d}|S )Nr/   z%sr9   ))r,   __getattribute__r+   r*   _format_errors)r0   namer/   r2   s      r   r=   z ValidationError.__getattribute__f   sR    '*409.{{$IQt':':'<&=Q?r   c                     | j                   S r4   _messager6   s    r   _get_messagezValidationError._get_messageo   s    }}r   c                     || _         y r4   rA   )r0   r/   s     r   _set_messagezValidationError._set_messager   s	    r   c                 N    fd| j                   si S  | j                         S )zReturns 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                     i }t        | t              r%| j                         D ]  \  }} |      ||<    |S t        | t              r| j                  r | j                        S t        |       S r4   )
isinstancedictitemsr   r*   r5   )sourceerrors_dictr+   error
build_dicts       r   rN   z+ValidationError.to_dict.<locals>.build_dict   sp    K&$')/ @%J.8.?K
+@  FO4!&--006{"r   )r*   )r0   rN   s    @r   to_dictzValidationError.to_dictw   s%    
	 {{I$++&&r   c           	      (   dfd	t        t              }| j                         j                         D ]  \  }}| |         j	                  |       ! dj                  |j                         D cg c]  \  }}| d|  c}}      S c c}}w )z5Returns a string listing all errors within a documentc           
      6   t        | t              r&dj                  | D cg c]
  } |       c}      } nIt        | t              r9dj                  | j	                         D cg c]  \  }} ||       c}}      } |r	| d|  }|S | }|S c c}w c c}}w )N .)rH   listjoinrI   rJ   )valueprefixkvresultsgenerate_keys        r   r[   z4ValidationError._format_errors.<locals>.generate_key   s    %&5!Aa,q/!ABE4(!OA,q!"4!OP-3%)GN :?GN "B!Os   B&B
rR   z:  )r   rT   rO   rJ   appendrU   )r0   
error_dictrX   rY   r[   s       @r   r>   zValidationError._format_errors   s    	 !&
LLN((* 	2DAq|A'..q1	2xx1A1A1CDAA3bDEEDs   5B
r\   )r   r   r   r'   r*   r+   rB   r-   r7   r:   r=   rC   rE   propertyr/   rO   r>   __classcell__)r2   s   @r   r   r   K   sP     FJH!=  |\2G'2Fr   r   c                       e Zd ZdZy)r   z9Raise when a user uses a feature that has been DeprecatedNr&   r   r   r   r   r      s    Cr   r   N)collectionsr   __all__	Exceptionr   r   r   AttributeErrorr   r   r   r	   r
   r   r   r   r   AssertionErrorr   r   r   r   r   <module>rh      s    #"	9 		( 		/ 		. 		' 		2 		, 		) 		^ 		^ 		 	, TFn TFn	* 	r   