
    &g                        S r SSKJr  SSKJrJrJrJrJr  SSK	J
r
Jr  SSKJr  \(       a  SSKJr            S
S jr      SS jrg	)zRConstants, types, and classes shared across Client Bulk Write API implementations.    )annotations)TYPE_CHECKINGAnyMappingMutableMappingNoReturn)ClientBulkWriteExceptionOperationFailure)_get_wce_doc)_DocumentOutc                f   UR                  S5      (       a  US   US'   US==   UR                  SS5      -  ss'   US==   UR                  SS5      -  ss'   US==   UR                  SS5      -  ss'   US==   UR                  SS5      -  ss'   US==   UR                  SS5      -  ss'   UR                  S5      nU(       aC  U H=  nUR                  5       nUS	   U-   nXvS	'   X   S
   US'   US   R                  U5        M?     [        U5      nU(       a  US   R                  U5        gg)z?Merge result of a single bulk write batch into the full result.error	nInsertedr   nDeletednMatched	nModified	nUpsertedwriteErrorsidx   opwriteConcernErrorsN)getcopyappendr   )	opsoffsetfull_resultresultwrite_errorsdocreplacementoriginal_indexwces	            `C:\Suresh\moveshuttle\MDcreated\moveengine\venv\Lib\site-packages\pymongo/_client_bulk_shared.py_merge_commandr&      s1    zz'%gG

; ::
vzz*a88
vzz*a88

; ::

; ::::m,LC((*K Z&0N!/ # 3A 6K&--k:   v
C
()005     c                   U S   (       aO  U S   R                  S S9  U S   S   nUS   nUS   nUS:X  a$  UR                  S5      (       a  S	n[        XSU 5      e[        U S
   [        5      (       a  [        X5      U S
   e[        X5      e)z6Raise a ClientBulkWriteException from the full result.r   c                    U S   $ )Nr    )r   s    r%   <lambda>4_throw_client_bulk_write_exception.<locals>.<lambda>B   s    %,r'   )keyr   codeerrmsg   zTransaction numberszrThis MongoDB deployment does not support retryable writes. Please add retryWrites=false to your connection string.r   )sort
startswithr
   
isinstanceBaseExceptionr	   )r   verbose_resultserrr.   msgr/   s         r%   "_throw_client_bulk_write_exceptionr8   <   s    
 =!M"'',F'G-(+6{(m2:#..)>??- 
 #6==+g&66&{D+V]J^^
";
@@r'   N)
r   z#list[tuple[str, Mapping[str, Any]]]r   intr   zMutableMapping[str, Any]r   zMapping[str, Any]returnNone)r   r   r5   boolr:   r   )__doc__
__future__r   typingr   r   r   r   r   pymongo.errorsr	   r
   pymongo.helpers_sharedr   pymongo.typingsr   r&   r8   r*   r'   r%   <module>rC      su     Y " H H E /,6	,66 *6 	6
 
6@AA04AAr'   