
    FCf                        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)a\  Represent a response from the server.

        :param data: A network response message.
        :param address: (host, port) of the source server.
        :param request_id: The request id of this operation.
        :param duration: The duration of the operation.
        :param from_command: if the response is the result of a db command.
        Nr   )selfdataaddress
request_iddurationfrom_commanddocss          P/var/www/highfloat_scraper/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.data7        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_idA   s     r#   c                    | j                   S )zThe duration of the operation.)r   r%   s    r!   r   zResponse.durationF   s     ~~r#   c                    | j                   S )z.If the response is a result from a db command.)r   r%   s    r!   r   zResponse.from_commandK   s     !!!r#   c                    | j                   S )zThe decoded document(s).)r   r%   s    r!   r    zResponse.docsP   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%  	
 &  *0           " "  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)a<  Represent a response to an exhaust cursor's initial query.

        :param data:  A network response message.
        :param address: (host, port) of the source server.
        :param conn: The Connection used for the initial query.
        :param request_id: The request id of this operation.
        :param duration: The duration of the operation.
        :param from_command: If the response is the result of a db command.
        :param docs: List of documents.
        :param 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__Y   s+    . 	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.connt   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:   V   s    *I*%* * 	*
 * &* * !* *6   " "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7 7t-"X -"r#   