Ë
    ÷eœiC3  ã                  óê   — d Z ddlmZ ddlmZmZmZmZmZ ddl	m
Z
  G d„ 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y)z{Result class definitions.

.. seealso:: This module is compatible with both the synchronous and asynchronous PyMongo APIs.
é    )Úannotations)ÚAnyÚMappingÚMutableMappingÚOptionalÚcast)ÚInvalidOperationc                  ó>   — e Zd ZdZdZdd„Zd	d„Zd
d„Zedd„«       Z	y)Ú_WriteResultz$Base class for write result classes.)Ú__acknowledgedc                ó   — || _         y ©N©Ú_WriteResult__acknowledged)ÚselfÚacknowledgeds     úd/var/www/html/Whatsapp_Customer_Support_Chatbot/venv/lib/python3.12/site-packages/pymongo/results.pyÚ__init__z_WriteResult.__init__   s
   € Ø*ˆÕó    c                óN   — | j                   j                  › d| j                  › d�S )Nú(ú))Ú	__class__Ú__name__r   ©r   s    r   Ú__repr__z_WriteResult.__repr__"   s'   € Ø—.‘.×)Ñ)Ð*¨!¨D×,?Ñ,?Ð+@ÀÐBÐBr   c                ó:   — | j                   st        d|› d�«      ‚y)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_unacknowledgedz%_WriteResult._raise_if_unacknowledged%   s.   € à×"Ò"Ü"Ø˜}˜oð .ð óð ð #r   c                ó   — | j                   S )aC  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   z_WriteResult.acknowledged/   s   € ð" ×"Ñ"Ð"r   N)r   ÚboolÚreturnÚNone©r$   Ústr©r    r'   r$   r%   ©r$   r#   )
r   Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__r   r   r!   Úpropertyr   © r   r   r   r      s.   „ Ù.à#€Ió+óCóð ò#ó ñ#r   r   c                  óB   ‡ — e Zd ZdZdZdˆ fd„Zdd„Zedd„«       Zˆ xZ	S )	ÚInsertOneResultz“The return type for :meth:`~pymongo.collection.Collection.insert_one`
    and as part of :meth:`~pymongo.mongo_client.MongoClient.bulk_write`.
    )Ú__inserted_idc                ó2   •— || _         t        ‰| �	  |«       y r   )Ú_InsertOneResult__inserted_idÚsuperr   )r   Úinserted_idr   r   s      €r   r   zInsertOneResult.__init__J   s   ø€ Ø(ˆÔÜ‰Ñ˜Õ&r   c                óh   — | j                   j                  › d| j                  ›d| j                  › d�S ©Nr   z, acknowledged=r   )r   r   r4   r   r   s    r   r   zInsertOneResult.__repr__N   s7   € à�~‰~×&Ñ&Ð' q¨×);Ñ);Ð(>¸oÈd×N_ÑN_ÐM`Ð`aÐbð	
r   c                ó   — | j                   S )zThe inserted document's _id.)r4   r   s    r   r6   zInsertOneResult.inserted_idS   s   € ð ×!Ñ!Ð!r   )r6   r   r   r#   r$   r%   r&   ©r$   r   )
r   r*   r+   r,   r-   r   r   r.   r6   Ú__classcell__©r   s   @r   r1   r1   C   s-   ø„ ñð #€Iõ'ó
ð
 ò"ó ô"r   r1   c                  óB   ‡ — e Zd ZdZdZdˆ fd„Zdd„Zedd„«       Zˆ xZ	S )	ÚInsertManyResultzGThe return type for :meth:`~pymongo.collection.Collection.insert_many`.)Ú__inserted_idsc                ó2   •— || _         t        ‰| �	  |«       y r   )Ú_InsertManyResult__inserted_idsr5   r   )r   Úinserted_idsr   r   s      €r   r   zInsertManyResult.__init__^   s   ø€ Ø*ˆÔÜ‰Ñ˜Õ&r   c                óh   — | j                   j                  › d| j                  ›d| j                  › d�S r8   )r   r   rA   r   r   s    r   r   zInsertManyResult.__repr__b   s7   € à�~‰~×&Ñ&Ð' q¨×)<Ñ)<Ð(?¸Èt×O`ÑO`ÐNaÐabÐcð	
r   c                ó   — | j                   S )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.
        )rA   r   s    r   rB   zInsertManyResult.inserted_idsg   s   € ð ×"Ñ"Ð"r   )rB   ú	list[Any]r   r#   r$   r%   r&   )r$   rE   )
r   r*   r+   r,   r-   r   r   r.   rB   r;   r<   s   @r   r>   r>   Y   s)   ø„ ÙQà#€Iõ'ó
ð
 ò#ó ô#r   r>   c                  ó˜   ‡ — e Zd ZdZdZ	 d
	 	 	 	 	 dˆ fd„Zdd„Zedd„«       Zedd„«       Z	edd„«       Z
edd„«       Zedd	„«       Zˆ xZS )ÚUpdateResulta  The 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                ó@   •— || _         || _        t        ‰| �  |«       y r   )Ú_UpdateResult__raw_resultÚ_UpdateResult__in_client_bulkr5   r   )r   Ú
raw_resultr   Úin_client_bulkr   s       €r   r   zUpdateResult.__init__   s"   ø€ ð 'ˆÔØ .ˆÔÜ‰Ñ˜Õ&r   c                óh   — | j                   j                  › d| j                  ›d| j                  › d�S r8   )r   r   rK   r   r   s    r   r   zUpdateResult.__repr__‰   ó6   € Ø—.‘.×)Ñ)Ð*¨!¨D×,=Ñ,=Ð+@ÀÐPT×PaÑPaÐObÐbcÐdÐdr   c                ó   — | j                   S ©z/The raw result document returned by the server.©rK   r   s    r   rM   zUpdateResult.raw_resultŒ   ó   € ð × Ñ Ð r   c                óª   — | j                  d«       | j                  €J ‚| j                  s| j                  �y| j                  j	                  dd«      S )z0The number of documents matched for this update.Úmatched_countr   Ún)r!   rK   rL   Úupserted_idÚgetr   s    r   rV   zUpdateResult.matched_count‘   sT   € ð 	×%Ñ% oÔ6Ø× Ñ Ð,Ð,Ð,Ø×$Ò$¨×)9Ñ)9Ð)EØØ× Ñ ×$Ñ$ S¨!Ó,Ð,r   c                ó’   — | j                  d«       | j                  €J ‚t        t        | j                  j	                  d«      «      S ©z!The number of documents modified.Úmodified_countÚ	nModified)r!   rK   r   ÚintrY   r   s    r   r\   zUpdateResult.modified_countš   sC   € ð 	×%Ñ%Ð&6Ô7Ø× Ñ Ð,Ð,Ð,Ü”C˜×*Ñ*×.Ñ.¨{Ó;Ó<Ð<r   c                óê   — | j                  d«       | j                  €J ‚| j                  r-| j                  j                  d«      r| j                  d   d   S | j                  j                  dd«      S )z^The _id of the inserted document if an upsert took place. Otherwise
        ``None``.
        rX   NÚupsertedÚ_id)r!   rK   rL   rY   r   s    r   rX   zUpdateResult.upserted_id¡   so   € ð
 	×%Ñ% mÔ4Ø× Ñ Ð,Ð,Ð,Ø× Ò  T×%6Ñ%6×%:Ñ%:¸:Ô%FØ×$Ñ$ ZÑ0°Ñ7Ð7Ø× Ñ ×$Ñ$ Z°Ó6Ð6r   c                ó:   — | j                   €J ‚d| j                   v S )zEWhether an upsert took place.

        .. versionadded:: 4.9
        r`   rS   r   s    r   Ú
did_upsertzUpdateResult.did_upsert¬   s'   € ð × Ñ Ð,Ð,Ð,Ø˜T×.Ñ.Ð.Ð.r   )F)rM   úOptional[Mapping[str, Any]]r   r#   rN   r#   r&   )r$   rd   ©r$   r^   r:   r)   )r   r*   r+   r,   r-   r   r   r.   rM   rV   r\   rX   rc   r;   r<   s   @r   rG   rG   s   sŸ   ø„ ñð€Ið  %ð	'à/ð'ð ð'ð õ	'óeð ò!ó ð!ð ò-ó ð-ð ò=ó ð=ð ò7ó ð7ð ò/ó ô/r   rG   c                  óT   ‡ — e Zd ZdZdZdˆ fd„Zdd„Zed	d„«       Zed
d„«       Z	ˆ xZ
S )ÚDeleteResultzÎThe 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`.
    )rH   c                ó2   •— || _         t        ‰| �	  |«       y r   )Ú_DeleteResult__raw_resultr5   r   )r   rM   r   r   s      €r   r   zDeleteResult.__init__¾   s   ø€ Ø&ˆÔÜ‰Ñ˜Õ&r   c                óh   — | j                   j                  › d| j                  ›d| j                  › d�S r8   )r   r   ri   r   r   s    r   r   zDeleteResult.__repr__Â   rP   r   c                ó   — | j                   S rR   )ri   r   s    r   rM   zDeleteResult.raw_resultÅ   rT   r   c                ó\   — | j                  d«       | j                  j                  dd«      S )ú The number of documents deleted.Údeleted_countrW   r   )r!   ri   rY   r   s    r   rn   zDeleteResult.deleted_countÊ   s+   € ð 	×%Ñ% oÔ6Ø× Ñ ×$Ñ$ S¨!Ó,Ð,r   )rM   úMapping[str, Any]r   r#   r$   r%   r&   )r$   ro   re   )r   r*   r+   r,   r-   r   r   r.   rM   rn   r;   r<   s   @r   rg   rg   ¶   sB   ø„ ñð
 "€Iõ'óeð ò!ó ð!ð ò-ó ô-r   rg   c                  óœ   ‡ — e Zd ZdZdZdˆ fd„Zdd„Zedd„«       Zedd„«       Z	edd„«       Z
edd„«       Zedd	„«       Zedd
„«       Zˆ xZS )Ú_BulkWriteResultBasez.Private base class for bulk write API results.)Ú__bulk_api_resultc                ó2   •— || _         t        ‰| �	  |«       y r   )Ú%_BulkWriteResultBase__bulk_api_resultr5   r   ©r   Úbulk_api_resultr   r   s      €r   r   z_BulkWriteResultBase.__init__Ö   s   ø€ Ø!0ˆÔÜ‰Ñ˜Õ&r   c                óh   — | j                   j                  › d| j                  ›d| j                  › d�S r8   )r   r   rt   r   r   s    r   r   z_BulkWriteResultBase.__repr__Ú   s6   € Ø—.‘.×)Ñ)Ð*¨!¨D×,BÑ,BÐ+EÀ_ÐUY×UfÑUfÐTgÐghÐiÐir   c                ó   — | j                   S )zThe raw bulk write API result.)rt   r   s    r   rv   z$_BulkWriteResultBase.bulk_api_resultÝ   s   € ð ×%Ñ%Ð%r   c                óv   — | j                  d«       t        t        | j                  j	                  d«      «      S )z!The number of documents inserted.Úinserted_countÚ	nInserted©r!   r   r^   rt   rY   r   s    r   rz   z#_BulkWriteResultBase.inserted_countâ   ó1   € ð 	×%Ñ%Ð&6Ô7Ü”C˜×/Ñ/×3Ñ3°KÓ@ÓAÐAr   c                óv   — | j                  d«       t        t        | j                  j	                  d«      «      S )z.The number of documents matched for an update.rV   ÚnMatchedr|   r   s    r   rV   z"_BulkWriteResultBase.matched_countè   s0   € ð 	×%Ñ% oÔ6Ü”C˜×/Ñ/×3Ñ3°JÓ?Ó@Ð@r   c                óv   — | j                  d«       t        t        | j                  j	                  d«      «      S r[   r|   r   s    r   r\   z#_BulkWriteResultBase.modified_countî   r}   r   c                óä   — | j                  d«       d| j                  v r)t        t        | j                  j	                  d«      «      S t        t        | j                  j	                  d«      «      S )rm   rn   ÚnRemovedÚnDeleted)r!   rt   r   r^   rY   r   s    r   rn   z"_BulkWriteResultBase.deleted_countô   s\   € ð 	×%Ñ% oÔ6Ø˜×/Ñ/Ñ/Üœ˜T×3Ñ3×7Ñ7¸
ÓCÓDÐDäœ˜T×3Ñ3×7Ñ7¸
ÓCÓDÐDr   c                óv   — | j                  d«       t        t        | j                  j	                  d«      «      S )z!The number of documents upserted.Úupserted_countÚ	nUpsertedr|   r   s    r   r…   z#_BulkWriteResultBase.upserted_countý   r}   r   ©rv   údict[str, Any]r   r#   r$   r%   r&   )r$   rˆ   re   )r   r*   r+   r,   r-   r   r   r.   rv   rz   rV   r\   rn   r…   r;   r<   s   @r   rq   rq   Ñ   s˜   ø„ Ù8à&€Iõ'ójð ò&ó ð&ð òBó ðBð
 òAó ðAð
 òBó ðBð
 òEó ðEð òBó ôBr   rq   c                  óB   ‡ — e Zd ZdZdZdˆ fd„Zdd„Zedd„«       Zˆ xZ	S )	ÚBulkWriteResultz>An object wrapper for collection-level bulk write API results.r/   c                ó&   •— t         ‰| �  ||«       y)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)r5   r   ru   s      €r   r   zBulkWriteResult.__init__	  s   ø€ ô 	‰Ñ˜¨,Õ7r   c                óh   — | j                   j                  › d| j                  ›d| j                  › d�S r8   )r   r   rv   r   r   s    r   r   zBulkWriteResult.__repr__  s8   € à�~‰~×&Ñ&Ð' q¨×)=Ñ)=Ð(@ÀÐPT×PaÑPaÐObÐbcÐdð	
r   c                ó�   — | j                  d«       | j                  r$| j                  d   D �ci c]  }|d   |d   “Œ c}S yc c}w )z=A map of operation index to the _id of the upserted document.Úupserted_idsr`   Úindexra   N)r!   rv   )r   Úupserts     r   rŽ   zBulkWriteResult.upserted_ids  sN   € ð 	×%Ñ% nÔ5Ø×ÒØAE×AUÑAUÐV`ÑAaÖb°v�F˜7‘O V¨E¡]Ñ2ÒbÐbØùò cs   ¯Ar‡   r&   )r$   zOptional[dict[int, Any]])
r   r*   r+   r,   r-   r   r   r.   rŽ   r;   r<   s   @r   rŠ   rŠ     s)   ø„ ÙHà€Iõ8ó
ð
 òó ôr   rŠ   c                  ó�   ‡ — e Zd ZdZdZ	 	 	 	 	 	 	 	 d
ˆ fd„Zdd„Zdd„Zedd„«       Z	edd„«       Z
edd„«       Zedd	„«       Zˆ xZS )ÚClientBulkWriteResultz:An object wrapper for client-level bulk write API results.)Ú__has_verbose_resultsc                ó4   •— || _         t        ‰| �	  ||«       y)aU  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_resultsr5   r   )r   rv   r   Úhas_verbose_resultsr   s       €r   r   zClientBulkWriteResult.__init__&  s    ø€ ð" &9ˆÔ"Ü‰ÑØØõ	
r   c                óŽ   — dj                  | j                  j                  | j                  | j                  | j
                  «      S )Nz%{}({!r}, acknowledged={}, verbose={}))Úformatr   r   rv   r   r–   r   s    r   r   zClientBulkWriteResult.__repr__=  s=   € Ø6×=Ñ=Ø�N‰N×#Ñ#Ø× Ñ Ø×ÑØ×$Ñ$ó	
ð 	
r   c                ó:   — | j                   st        d|› d�«      ‚y)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_verbosez+ClientBulkWriteResult._raise_if_not_verboseE  s0   € à×)Ò)Ü"Ø˜}˜oð .Að Aóð ð *r   c                ó   — | j                   S )z/Whether the returned results should be verbose.)r•   r   s    r   r–   z)ClientBulkWriteResult.has_verbose_resultsN  s   € ð ×)Ñ)Ð)r   c                ó²   — | j                  d«       | j                  d«       t        t        t        t
        f   | j                  j                  d«      «      S )z:A map of successful insertion operations to their results.Úinsert_resultsÚinsertResults)r!   rš   r   r   r^   r1   rv   rY   r   s    r   r�   z$ClientBulkWriteResult.insert_resultsS  sP   € ð 	×%Ñ%Ð&6Ô7Ø×"Ñ"Ð#3Ô4ÜÜ”CœÐ(Ñ)Ø× Ñ ×$Ñ$ _Ó5ó
ð 	
r   c                ó²   — | j                  d«       | j                  d«       t        t        t        t
        f   | j                  j                  d«      «      S )z7A map of successful update operations to their results.Úupdate_resultsÚupdateResults)r!   rš   r   r   r^   rG   rv   rY   r   s    r   r    z$ClientBulkWriteResult.update_results]  óP   € ð 	×%Ñ%Ð&6Ô7Ø×"Ñ"Ð#3Ô4ÜÜ”CœÐ%Ñ&Ø× Ñ ×$Ñ$ _Ó5ó
ð 	
r   c                ó²   — | j                  d«       | j                  d«       t        t        t        t
        f   | j                  j                  d«      «      S )z7A map of successful delete operations to their results.Údelete_resultsÚdeleteResults)r!   rš   r   r   r^   rg   rv   rY   r   s    r   r¤   z$ClientBulkWriteResult.delete_resultsg  r¢   r   )rv   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*   r+   r,   r-   r   r   rš   r.   r–   r�   r    r¤   r;   r<   s   @r   r’   r’   !  s�   ø„ ÙDà*€Ið
à1ð
ð ð
ð "ð	
ð
 
õ
ó.
óð ò*ó ð*ð ò
ó ð
ð ò
ó ð
ð ò
ó ô
r   r’   N)r,   Ú
__future__r   Útypingr   r   r   r   r   Úpymongo.errorsr	   r   r1   r>   rG   rg   rq   rŠ   r’   r/   r   r   ú<module>r©      s�   ðñõ #ç ?Õ ?å +÷&#ñ &#ôR"�lô "ô,#�|ô #ô4@/�<ô @/ôF-�<ô -ô60B˜<ô 0BôfÐ*ô ô:N
Ð0õ N
r   