
    h                         d Z ddlm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.    )InvalidOperationc                   0    e Zd ZdZdZd Zd Zed        Zy)_WriteResultz$Base class for write result classes.)__acknowledgedc                     || _         y N_WriteResult__acknowledged)selfacknowledgeds     R/var/www/html/ranktracker/api/venv/lib/python3.12/site-packages/pymongo/results.py__init__z_WriteResult.__init__   s
    *    c                 :    | j                   st        d|d      y)z8Raise an exception on property access if unacknowledged.z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)    """ 0=$? @ @ #r   c                     | j                   S )aB  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
          attibutes 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)	__name__
__module____qualname____doc__	__slots__r   r   propertyr    r   r   r   r      s)    .#I+@ # #r   r   c                   6     e Zd ZdZdZ fdZed        Z xZS )InsertOneResultzKThe return type for :meth:`~pymongo.collection.Collection.insert_one`.
    )__inserted_idr   c                 :    || _         t        t        |   |       y r   )_InsertOneResult__inserted_idsuperr   r   )r   inserted_idr   	__class__s      r   r   zInsertOneResult.__init__>   s    (ot-l;r   c                     | j                   S )zThe inserted document's _id.)r    r   s    r   r"   zInsertOneResult.inserted_idB   s     !!!r   )	r   r   r   r   r   r   r   r"   __classcell__r#   s   @r   r   r   8   s(     4I< " "r   r   c                   6     e Zd ZdZdZ fdZed        Z xZS )InsertManyResultzLThe return type for :meth:`~pymongo.collection.Collection.insert_many`.
    )__inserted_idsr   c                 :    || _         t        t        |   |       y r   )_InsertManyResult__inserted_idsr!   r(   r   )r   inserted_idsr   r#   s      r   r   zInsertManyResult.__init__N   s    *.|<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.
        )r+   r   s    r   r,   zInsertManyResult.inserted_idsR   s     """r   )	r   r   r   r   r   r   r   r,   r%   r&   s   @r   r(   r(   H   s(     5I= # #r   r(   c                   f     e Zd ZdZdZ fdZed        Zed        Zed        Z	ed        Z
 xZS )UpdateResultzThe return type for :meth:`~pymongo.collection.Collection.update_one`,
    :meth:`~pymongo.collection.Collection.update_many`, and
    :meth:`~pymongo.collection.Collection.replace_one`.
    __raw_resultr   c                 :    || _         t        t        |   |       y r   )_UpdateResult__raw_resultr!   r/   r   r   
raw_resultr   r#   s      r   r   zUpdateResult.__init__f       &lD*<8r   c                     | j                   S z/The raw result document returned by the server.)r3   r   s    r   r5   zUpdateResult.raw_resultj           r   c                 v    | j                  d       | j                  y| j                  j                  dd      S )z0The number of documents matched for this update.matched_countr   n)r   upserted_idr3   getr   s    r   r;   zUpdateResult.matched_counto   s:     	%%o6'  $$S!,,r   c                 Z    | j                  d       | j                  j                  d      S a  The number of documents modified.

        .. note:: modified_count is only reported by MongoDB 2.6 and later.
          When connected to an earlier server version, or in certain mixed
          version sharding configurations, this attribute will be set to
          ``None``.
        modified_count	nModifiedr   r3   r>   r   s    r   rA   zUpdateResult.modified_countw   s*     	%%&67  $$[11r   c                 Z    | j                  d       | j                  j                  d      S )z^The _id of the inserted document if an upsert took place. Otherwise
        ``None``.
        r=   upsertedrC   r   s    r   r=   zUpdateResult.upserted_id   s)    
 	%%m4  $$Z00r   )r   r   r   r   r   r   r   r5   r;   rA   r=   r%   r&   s   @r   r/   r/   ^   sd    
 3I9 ! ! - - 	2 	2 1 1r   r/   c                   F     e Zd ZdZdZ fdZed        Zed        Z xZ	S )DeleteResultzThe return type for :meth:`~pymongo.collection.Collection.delete_one`
    and :meth:`~pymongo.collection.Collection.delete_many`r0   c                 :    || _         t        t        |   |       y r   )_DeleteResult__raw_resultr!   rG   r   r4   s      r   r   zDeleteResult.__init__   r6   r   c                     | j                   S r8   )rI   r   s    r   r5   zDeleteResult.raw_result   r9   r   c                 \    | j                  d       | j                  j                  dd      S ) The number of documents deleted.deleted_countr<   r   )r   rI   r>   r   s    r   rM   zDeleteResult.deleted_count   s+     	%%o6  $$S!,,r   )
r   r   r   r   r   r   r   r5   rM   r%   r&   s   @r   rG   rG      s<    > 3I9 ! ! - -r   rG   c                        e Zd ZdZdZ fdZed        Zed        Zed        Z	ed        Z
ed        Zed	        Zed
        Z xZS )BulkWriteResultz-An object wrapper for bulk API write results.)__bulk_api_resultr   c                 :    || _         t        t        |   |       y)a<  Create a BulkWriteResult instance.

        :Parameters:
          - `bulk_api_result`: A result dict from the bulk API
          - `acknowledged`: Was this write result acknowledged? If ``False``
            then all properties of this object will raise
            :exc:`~pymongo.errors.InvalidOperation`.
        N)!_BulkWriteResult__bulk_api_resultr!   rO   r   )r   bulk_api_resultr   r#   s      r   r   zBulkWriteResult.__init__   s     "1ot-l;r   c                     | j                   S )zThe raw bulk API result.)rR   r   s    r   rS   zBulkWriteResult.bulk_api_result   s     %%%r   c                 Z    | j                  d       | j                  j                  d      S )z!The number of documents inserted.inserted_count	nInsertedr   rR   r>   r   s    r   rV   zBulkWriteResult.inserted_count   *     	%%&67%%))+66r   c                 Z    | j                  d       | j                  j                  d      S )z.The number of documents matched for an update.r;   nMatchedrX   r   s    r   r;   zBulkWriteResult.matched_count   )     	%%o6%%))*55r   c                 Z    | j                  d       | j                  j                  d      S r@   rX   r   s    r   rA   zBulkWriteResult.modified_count   s*     	%%&67%%))+66r   c                 Z    | j                  d       | j                  j                  d      S )rL   rM   nRemovedrX   r   s    r   rM   zBulkWriteResult.deleted_count   r\   r   c                 Z    | j                  d       | j                  j                  d      S )z!The number of documents upserted.upserted_count	nUpsertedrX   r   s    r   ra   zBulkWriteResult.upserted_count   rY   r   c                 |    | j                  d       | j                  rt        d | j                  d   D              S y)z=A map of operation index to the _id of the upserted document.upserted_idsc              3   0   K   | ]  }|d    |d   f  yw)index_idNr   ).0upserts     r   	<genexpr>z/BulkWriteResult.upserted_ids.<locals>.<genexpr>   s'      H"  &-8 Hs   rE   N)r   rR   dictrS   r   s    r   rd   zBulkWriteResult.upserted_ids   sI     	%%n5!! H&*&:&::&FH H H "r   )r   r   r   r   r   r   r   rS   rV   r;   rA   rM   ra   rd   r%   r&   s   @r   rO   rO      s    77I
< & & 7 7
 6 6
 	7 	7 6 6
 7 7
 H Hr   rO   N)
r   pymongo.errorsr   objectr   r   r(   r/   rG   rO   r   r   r   <module>rn      s[      +!#6 !#H"l " #| #,+1< +1\-< -,@Hl @Hr   