
    =h                        d Z ddlmZ ddlmZmZmZmZmZm	Z	 erddl
mZ ddlmZmZ ddlmZ ddlmZmZ  G d d	      Z G d
 de      Zy)z%Represent a response from the server.    )annotations)TYPE_CHECKINGAnyMappingOptionalSequenceUnion)	timedelta)_OpMsg_OpReply)
Connection)_Address_DocumentOutc                      e Zd Z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y	)Response_data_address_request_id	_duration_from_command_docsc                X    || _         || _        || _        || _        || _        || _        y)al  Represent a response from the server.

        :Parameters:
          - `data`: A network response message.
          - `address`: (host, port) of the source server.
          - `request_id`: The request id of this operation.
          - `duration`: The duration of the operation.
          - `from_command`: if the response is the result of a db command.
        Nr   )selfdataaddress
request_iddurationfrom_commanddocss          `/var/www/html/phonemate/phone_mate_backend/venv/lib/python3.12/site-packages/pymongo/response.py__init__zResponse.__init__   s0    $ 
%!)
    c                    | j                   S )z!Server response's raw BSON bytes.)r   r   s    r!   r   zResponse.data8        zzr#   c                    | j                   S )z"(host, port) of the source server.)r   r%   s    r!   r   zResponse.address=   s     }}r#   c                    | j                   S )z!The request id of this operation.)r   r%   s    r!   r   zResponse.request_idB   s     r#   c                    | j                   S )zThe duration of the operation.)r   r%   s    r!   r   zResponse.durationG   s     ~~r#   c                    | j                   S )z.If the response is a result from a db command.)r   r%   s    r!   r   zResponse.from_commandL   s     !!!r#   c                    | j                   S )zThe decoded document(s).)r   r%   s    r!   r    zResponse.docsQ   r&   r#   N)r   Union[_OpMsg, _OpReply]r   r   r   intr   Optional[timedelta]r   boolr    Sequence[Mapping[str, Any]])returnr,   )r1   r   )r1   r-   )r1   r.   r1   r/   )r1   r0   )__name__
__module____qualname__	__slots__r"   propertyr   r   r   r   r   r     r#   r!   r   r      s    [I%  	
 &  *2           " "  r#   r   c                  h     e Zd ZdZ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d fdZedd       Zedd       Z xZS )PinnedResponse)_conn_more_to_comec	                J    t         	|   ||||||       || _        || _        y)aI  Represent a response to an exhaust cursor's initial query.

        :Parameters:
          - `data`:  A network response message.
          - `address`: (host, port) of the source server.
          - `conn`: The Connection used for the initial query.
          - `request_id`: The request id of this operation.
          - `duration`: The duration of the operation.
          - `from_command`: If the response is the result of a db command.
          - `docs`: List of documents.
          - `more_to_come`: Bool indicating whether cursor is ready to be
            exhausted.
        N)superr"   r;   r<   )
r   r   r   connr   r   r   r    more_to_come	__class__s
            r!   r"   zPinnedResponse.__init__Z   s+    0 	w
HlDQ
)r#   c                    | j                   S )zThe Connection used for the initial query.

        The server will send batches on this socket, without waiting for
        getMores from the client, until the result set is exhausted or there
        is an error.
        )r;   r%   s    r!   r?   zPinnedResponse.connv   s     zzr#   c                    | j                   S )zIf true, server is ready to send batches on the socket until the
        result set is exhausted or there is an error.
        )r<   r%   s    r!   r@   zPinnedResponse.more_to_come   s    
 !!!r#   )r   r,   r   r   r?   r   r   r-   r   r.   r   r/   r    zlist[_DocumentOut]r@   r/   )r1   r   r2   )	r3   r4   r5   r6   r"   r7   r?   r@   __classcell__)rA   s   @r!   r:   r:   W   s    *I*%* * 	*
 * &* * !* *8   " "r#   r:   N)__doc__
__future__r   typingr   r   r   r   r   r	   datetimer
   pymongo.messager   r   pymongo.poolr   pymongo.typingsr   r   r   r:   r8   r#   r!   <module>rL      s9    , " I I"0'68 8v."X ."r#   