o
    'èhå  ã                   @  s†   d Z ddlmZ ddlmZmZmZmZmZm	Z	 er2ddl
mZ ddlmZmZ ddlmZmZmZ G dd„ dƒZG d	d
„ d
eƒZdS )z%Represent a response from the server.é    )Úannotations)ÚTYPE_CHECKINGÚAnyÚMappingÚOptionalÚSequenceÚUnion)Ú	timedelta)Ú_OpMsgÚ_OpReply)Ú_AddressÚ_AgnosticConnectionÚ_DocumentOutc                   @  sn   e Zd ZdZddd„Zeddd„ƒZed dd„ƒZed!dd„ƒZed"dd„ƒZ	ed#dd„ƒZ
ed$dd„ƒZdS )%ÚResponse©Ú_dataÚ_addressÚ_request_idÚ	_durationÚ_from_commandÚ_docsÚdataúUnion[_OpMsg, _OpReply]Úaddressr   Ú
request_idÚintÚdurationúOptional[timedelta]Úfrom_commandÚboolÚdocsúSequence[Mapping[str, Any]]c                 C  s(   || _ || _|| _|| _|| _|| _dS )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   )Úselfr   r   r   r   r   r    © r#   úL/var/www/html/olx_land/venv/lib/python3.10/site-packages/pymongo/response.pyÚ__init__   s   
zResponse.__init__Úreturnc                 C  ó   | j S )z!Server response's raw BSON bytes.)r   ©r"   r#   r#   r$   r   6   ó   zResponse.datac                 C  r'   )z"(host, port) of the source server.)r   r(   r#   r#   r$   r   ;   r)   zResponse.addressc                 C  r'   )z!The request id of this operation.)r   r(   r#   r#   r$   r   @   r)   zResponse.request_idc                 C  r'   )zThe duration of the operation.)r   r(   r#   r#   r$   r   E   r)   zResponse.durationc                 C  r'   )z.If the response is a result from a db command.)r   r(   r#   r#   r$   r   J   r)   zResponse.from_commandc                 C  r'   )zThe decoded document(s).)r   r(   r#   r#   r$   r    O   r)   zResponse.docsN)r   r   r   r   r   r   r   r   r   r   r    r!   )r&   r   )r&   r   )r&   r   )r&   r   ©r&   r   )r&   r!   )Ú__name__Ú
__module__Ú__qualname__Ú	__slots__r%   Úpropertyr   r   r   r   r   r    r#   r#   r#   r$   r      s    
r   c                      s>   e Zd ZdZd‡ fdd„Zeddd„ƒZeddd„ƒZ‡  ZS )ÚPinnedResponse)Ú_connÚ_more_to_comer   r   r   r   Úconnr   r   r   r   r   r   r   r    úlist[_DocumentOut]Úmore_to_comec	           	        s&   t ƒ  ||||||¡ || _|| _dS )aL  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 AsyncConnection/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%   r1   r2   )	r"   r   r   r3   r   r   r   r    r5   ©Ú	__class__r#   r$   r%   X   s   
zPinnedResponse.__init__r&   c                 C  r'   )zïThe AsyncConnection/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.
        )r1   r(   r#   r#   r$   r3   s   s   zPinnedResponse.connc                 C  r'   )zIf true, server is ready to send batches on the socket until the
        result set is exhausted or there is an error.
        )r2   r(   r#   r#   r$   r5   }   s   zPinnedResponse.more_to_come)r   r   r   r   r3   r   r   r   r   r   r   r   r    r4   r5   r   )r&   r   r*   )	r+   r,   r-   r.   r%   r/   r3   r5   Ú__classcell__r#   r#   r7   r$   r0   U   s    	r0   N)Ú__doc__Ú
__future__r   Útypingr   r   r   r   r   r   Údatetimer	   Úpymongo.messager
   r   Úpymongo.typingsr   r   r   r   r0   r#   r#   r#   r$   Ú<module>   s    :