
    &g4                        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
   " S S5      r " S S\5      r " S	 S
\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      rg)z{Result class definitions.

.. seealso:: This module is compatible with both the synchronous and asynchronous PyMongo APIs.
    )annotations)AnyMappingMutableMappingOptionalcast)InvalidOperationc                  N    \ rS rSrSrSrS	S jrS
S jrSS jr\	SS j5       r
Srg)_WriteResult   z$Base class for write result classes.)__acknowledgedc                    Xl         g N_WriteResult__acknowledged)selfacknowledgeds     TC:\Suresh\moveshuttle\MDcreated\moveengine\venv\Lib\site-packages\pymongo/results.py__init___WriteResult.__init__   s    *    c                N    U R                   R                   SU R                   S3$ )N())	__class____name__r   r   s    r   __repr___WriteResult.__repr__"   s'    ..))*!D,?,?+@BBr   c                D    U R                   (       d  [        SU S35      eg)z8Raise an exception on property access if unacknowledged.A value for zi is not available when the write is unacknowledged. Check the acknowledged attribute to avoid this error.N)r   r	   r   property_names     r   _raise_if_unacknowledged%_WriteResult._raise_if_unacknowledged%   s.    """}o .   #r   c                    U R                   $ )a  Is this the result of an acknowledged write operation?

The :attr:`acknowledged` attribute will be ``False`` when using
``WriteConcern(w=0)``, otherwise ``True``.

.. note::
  If the :attr:`acknowledged` attribute is ``False`` all other
  attributes of this class will raise
  :class:`~pymongo.errors.InvalidOperation` when accessed. Values for
  other attributes cannot be determined if the write operation was
  unacknowledged.

.. seealso::
  :class:`~pymongo.write_concern.WriteConcern`
r   r   s    r   r   _WriteResult.acknowledged/   s    " """r   N)r   boolreturnNoner)   strr#   r,   r)   r*   r)   r(   )r   
__module____qualname____firstlineno____doc__	__slots__r   r   r$   propertyr   __static_attributes__ r   r   r   r      s.    .#I+C # #r   r   c                  R   ^  \ rS rSrSrSrSU 4S jjrSS jr\S	S j5       r	Sr
U =r$ )
InsertOneResultC   zThe return type for :meth:`~pymongo.collection.Collection.insert_one`
and as part of :meth:`~pymongo.mongo_client.MongoClient.bulk_write`.
)__inserted_idc                0   > Xl         [        TU ]	  U5        g r   )_InsertOneResult__inserted_idsuperr   )r   inserted_idr   r   s      r   r   InsertOneResult.__init__J   s    (&r   c                j    U R                   R                   SU R                  < SU R                   S3$ Nr   z, acknowledged=r   )r   r   r<   r   r   s    r   r   InsertOneResult.__repr__N   s7    ~~&&'q););(>odN_N_M``ab	
r   c                    U R                   $ )zThe inserted document's _id.)r<   r   s    r   r>   InsertOneResult.inserted_idS   s     !!!r   )r>   r   r   r(   r)   r*   r+   r)   r   )r   r/   r0   r1   r2   r3   r   r   r4   r>   r5   __classcell__r   s   @r   r8   r8   C   s-     #I'

 " "r   r8   c                  R   ^  \ rS rSrSrSrSU 4S jjrSS jr\S	S j5       r	Sr
U =r$ )
InsertManyResultY   zGThe return type for :meth:`~pymongo.collection.Collection.insert_many`.)__inserted_idsc                0   > Xl         [        TU ]	  U5        g r   )_InsertManyResult__inserted_idsr=   r   )r   inserted_idsr   r   s      r   r   InsertManyResult.__init__^   s    *&r   c                j    U R                   R                   SU R                  < SU R                   S3$ rA   )r   r   rM   r   r   s    r   r   InsertManyResult.__repr__b   s7    ~~&&'q)<)<(?tO`O`Naabc	
r   c                    U R                   $ )a  A list of _ids of the inserted documents, in the order provided.

.. note:: If ``False`` is passed for the `ordered` parameter to
  :meth:`~pymongo.collection.Collection.insert_many` the server
  may have inserted the documents in a different order than what
  is presented here.
)rM   r   s    r   rN   InsertManyResult.inserted_idsg   s     """r   )rN   	list[Any]r   r(   r)   r*   r+   )r)   rT   )r   r/   r0   r1   r2   r3   r   r   r4   rN   r5   rF   rG   s   @r   rI   rI   Y   s)    Q#I'

 # #r   rI   c                     ^  \ rS rSrSrSr S     SU 4S jjjrSS jr\SS j5       r	\SS j5       r
\SS j5       r\SS	 j5       r\SS
 j5       rSrU =r$ )UpdateResults   zThe return type for :meth:`~pymongo.collection.Collection.update_one`,
:meth:`~pymongo.collection.Collection.update_many`, and
:meth:`~pymongo.collection.Collection.replace_one`, and as part of
:meth:`~pymongo.mongo_client.MongoClient.bulk_write`.
)__raw_result__in_client_bulkc                <   > Xl         X0l        [        TU ]  U5        g r   )_UpdateResult__raw_result_UpdateResult__in_client_bulkr=   r   )r   
raw_resultr   in_client_bulkr   s       r   r   UpdateResult.__init__   s     ' .&r   c                j    U R                   R                   SU R                  < SU R                   S3$ rA   )r   r   r[   r   r   s    r   r   UpdateResult.__repr__   6    ..))*!D,=,=+@PTPaPaObbcddr   c                    U R                   $ z/The raw result document returned by the server.r[   r   s    r   r]   UpdateResult.raw_result           r   c                    U R                  S5        U R                  c   eU R                  (       d  U R                  b  gU R                  R	                  SS5      $ )z0The number of documents matched for this update.matched_countr   n)r$   r[   r\   upserted_idgetr   s    r   ri   UpdateResult.matched_count   sT     	%%o6  ,,,$$)9)9)E  $$S!,,r   c                    U R                  S5        U R                  c   e[        [        U R                  R	                  S5      5      $ z!The number of documents modified.modified_count	nModified)r$   r[   r   intrl   r   s    r   rp   UpdateResult.modified_count   sC     	%%&67  ,,,C**..{;<<r   c                    U R                  S5        U R                  c   eU R                  (       a2  U R                  R                  S5      (       a  U R                  S   S   $ U R                  R                  SS5      $ )zNThe _id of the inserted document if an upsert took place. Otherwise
``None``.
rk   Nupserted_id)r$   r[   r\   rl   r   s    r   rk   UpdateResult.upserted_id   sr    
 	%%m4  ,,,  T%6%6%:%::%F%F$$Z077  $$Z66r   c                >    U R                   c   eSU R                   ;   $ )z5Whether an upsert took place.

.. versionadded:: 4.9
ru   re   r   s    r   
did_upsertUpdateResult.did_upsert   s'       ,,,T....r   )rY   rX   )F)r]   Optional[Mapping[str, Any]]r   r(   r^   r(   r+   )r)   r{   r)   rr   rE   r.   )r   r/   r0   r1   r2   r3   r   r   r4   r]   ri   rp   rk   ry   r5   rF   rG   s   @r   rV   rV   s   s    I  %	'/' ' 	' 'e ! ! - - = = 7 7 / /r   rV   c                  f   ^  \ rS rSrSrSrSU 4S jjrS	S jr\S
S j5       r	\SS j5       r
SrU =r$ )DeleteResult   zThe return type for :meth:`~pymongo.collection.Collection.delete_one`
and :meth:`~pymongo.collection.Collection.delete_many`
and as part of :meth:`~pymongo.mongo_client.MongoClient.bulk_write`.
)rX   c                0   > Xl         [        TU ]	  U5        g r   )_DeleteResult__raw_resultr=   r   )r   r]   r   r   s      r   r   DeleteResult.__init__   s    &&r   c                j    U R                   R                   SU R                  < SU R                   S3$ rA   )r   r   r   r   r   s    r   r   DeleteResult.__repr__   rb   r   c                    U R                   $ rd   )r   r   s    r   r]   DeleteResult.raw_result   rg   r   c                \    U R                  S5        U R                  R                  SS5      $ ) The number of documents deleted.deleted_countrj   r   )r$   r   rl   r   s    r   r   DeleteResult.deleted_count   s+     	%%o6  $$S!,,r   )r]   Mapping[str, Any]r   r(   r)   r*   r+   )r)   r   r|   )r   r/   r0   r1   r2   r3   r   r   r4   r]   r   r5   rF   rG   s   @r   r~   r~      sB    
 "I'e ! ! - -r   r~   c                     ^  \ rS rSrSrSrSU 4S jjrSS jr\SS j5       r	\SS j5       r
\SS j5       r\SS	 j5       r\SS
 j5       r\SS j5       rSrU =r$ )_BulkWriteResultBase   z.Private base class for bulk write API results.)__bulk_api_resultc                0   > Xl         [        TU ]	  U5        g r   )%_BulkWriteResultBase__bulk_api_resultr=   r   r   bulk_api_resultr   r   s      r   r   _BulkWriteResultBase.__init__   s    !0&r   c                j    U R                   R                   SU R                  < SU R                   S3$ rA   )r   r   r   r   r   s    r   r   _BulkWriteResultBase.__repr__   s6    ..))*!D,B,B+E_UYUfUfTgghiir   c                    U R                   $ )zThe raw bulk write API result.)r   r   s    r   r   $_BulkWriteResultBase.bulk_api_result   s     %%%r   c                v    U R                  S5        [        [        U R                  R	                  S5      5      $ )z!The number of documents inserted.inserted_count	nInsertedr$   r   rr   r   rl   r   s    r   r   #_BulkWriteResultBase.inserted_count   1     	%%&67C//33K@AAr   c                v    U R                  S5        [        [        U R                  R	                  S5      5      $ )z.The number of documents matched for an update.ri   nMatchedr   r   s    r   ri   "_BulkWriteResultBase.matched_count   s0     	%%o6C//33J?@@r   c                v    U R                  S5        [        [        U R                  R	                  S5      5      $ ro   r   r   s    r   rp   #_BulkWriteResultBase.modified_count   r   r   c                    U R                  S5        SU R                  ;   a)  [        [        U R                  R	                  S5      5      $ [        [        U R                  R	                  S5      5      $ )r   r   nRemovednDeleted)r$   r   r   rr   rl   r   s    r   r   "_BulkWriteResultBase.deleted_count   s\     	%%o6///T3377
CDDT3377
CDDr   c                v    U R                  S5        [        [        U R                  R	                  S5      5      $ )z!The number of documents upserted.upserted_count	nUpsertedr   r   s    r   r   #_BulkWriteResultBase.upserted_count   r   r   r   dict[str, Any]r   r(   r)   r*   r+   )r)   r   r|   )r   r/   r0   r1   r2   r3   r   r   r4   r   r   ri   rp   r   r   r5   rF   rG   s   @r   r   r      s    8&I'j & & B B
 A A
 B B
 E E B Br   r   c                  R   ^  \ rS rSrSrSrSU 4S jjrSS jr\S	S j5       r	Sr
U =r$ )
BulkWriteResulti  z>An object wrapper for collection-level bulk write API results.r6   c                $   > [         TU ]  X5        g)a  Create a BulkWriteResult instance.

:param bulk_api_result: A result dict from the collection-level bulk write API
:param acknowledged: Was this write result acknowledged? If ``False``
    then all properties of this object will raise
    :exc:`~pymongo.errors.InvalidOperation`.
N)r=   r   r   s      r   r   BulkWriteResult.__init__	  s     	7r   c                j    U R                   R                   SU R                  < SU R                   S3$ rA   )r   r   r   r   r   s    r   r   BulkWriteResult.__repr__  s8    ~~&&'q)=)=(@PTPaPaObbcd	
r   c                    U R                  S5        U R                  (       a&  U R                  S    Vs0 s H  oS   US   _M     sn$ gs  snf )z=A map of operation index to the _id of the upserted document.upserted_idsru   indexrv   N)r$   r   )r   upserts     r   r   BulkWriteResult.upserted_ids  sR     	%%n5AEAUAUV`AabAav7OVE]2Aabb cs   A
r   r+   )r)   zOptional[dict[int, Any]])r   r/   r0   r1   r2   r3   r   r   r4   r   r5   rF   rG   s   @r   r   r     s)    HI8

  r   r   c                     ^  \ rS rSrSrSr        SU 4S jjrSS jrSS jr\	SS j5       r
\	SS j5       r\	SS	 j5       r\	SS
 j5       rSrU =r$ )ClientBulkWriteResulti!  z:An object wrapper for client-level bulk write API results.)__has_verbose_resultsc                2   > X0l         [        TU ]	  UU5        g)a  Create a ClientBulkWriteResult instance.

:param bulk_api_result: A result dict from the client-level bulk write API
:param acknowledged: Was this write result acknowledged? If ``False``
    then all properties of this object will raise
    :exc:`~pymongo.errors.InvalidOperation`.
:param has_verbose_results: Should the returned result be verbose?
    If ``False``, then the ``insert_results``, ``update_results``, and
    ``delete_results`` properties of this object will raise
    :exc:`~pymongo.errors.InvalidOperation`.
N)+_ClientBulkWriteResult__has_verbose_resultsr=   r   )r   r   r   has_verbose_resultsr   s       r   r   ClientBulkWriteResult.__init__&  s    " &9"	
r   c                    SR                  U R                  R                  U R                  U R                  U R
                  5      $ )Nz%{}({!r}, acknowledged={}, verbose={}))formatr   r   r   r   r   r   s    r   r   ClientBulkWriteResult.__repr__=  s=    6==NN##  $$	
 	
r   c                D    U R                   (       d  [        SU S35      eg)zARaise an exception on property access if verbose results are off.r!   zv is not available when the results are not set to be verbose. Check the verbose_results attribute to avoid this error.N)r   r	   r"   s     r   _raise_if_not_verbose+ClientBulkWriteResult._raise_if_not_verboseE  s0    ))"}o .A A  *r   c                    U R                   $ )z/Whether the returned results should be verbose.)r   r   s    r   r   )ClientBulkWriteResult.has_verbose_resultsN  s     )))r   c                    U R                  S5        U R                  S5        [        [        [        [
        4   U R                  R                  S5      5      $ )z:A map of successful insertion operations to their results.insert_resultsinsertResults)r$   r   r   r   rr   r8   r   rl   r   s    r   r   $ClientBulkWriteResult.insert_resultsS  sP     	%%&67""#34C()  $$_5
 	
r   c                    U R                  S5        U R                  S5        [        [        [        [
        4   U R                  R                  S5      5      $ )z7A map of successful update operations to their results.update_resultsupdateResults)r$   r   r   r   rr   rV   r   rl   r   s    r   r   $ClientBulkWriteResult.update_results]  P     	%%&67""#34C%&  $$_5
 	
r   c                    U R                  S5        U R                  S5        [        [        [        [
        4   U R                  R                  S5      5      $ )z7A map of successful delete operations to their results.delete_resultsdeleteResults)r$   r   r   r   rr   r~   r   rl   r   s    r   r   $ClientBulkWriteResult.delete_resultsg  r   r   )r   zMutableMapping[str, Any]r   r(   r   r(   r)   r*   r+   r-   r.   )r)   zMapping[int, InsertOneResult])r)   zMapping[int, UpdateResult])r)   zMapping[int, DeleteResult])r   r/   r0   r1   r2   r3   r   r   r   r4   r   r   r   r   r5   rF   rG   s   @r   r   r   !  s    D*I
1
 
 "	

 

.
 * * 
 
 
 
 
 
r   r   N)r2   
__future__r   typingr   r   r   r   r   pymongo.errorsr	   r   r8   rI   rV   r~   r   r   r   r6   r   r   <module>r      s    # ? ? +&# &#R"l ",#| #4@/< @/F-< -60B< 0Bf* :N
0 N
r   