
    osj                        d dl mZ d dlZd dlZd dlmZ ddlmZmZm	Z	m
Z
mZmZmZmZmZmZ  G d d      Z G d d	e      Zy)
    )annotationsN)AsyncGenerator   )
URL
ExtensionsHeaderTypesOriginRequestResponseenforce_bytesenforce_headersenforce_urlinclude_request_headersc                      e Zd Zdddd	 	 	 	 	 	 	 	 	 	 	 ddZej
                  dddd	 	 	 	 	 	 	 	 	 	 	 dd       ZddZy)	AsyncRequestInterfaceN)headerscontent
extensionsc               t  K   t        |d      }t        |d      }t        |d      }t        |||      }t	        |||||      }| j                  |       d {   }	 |j                          d {    |j                          d {    |S 7 77  7 
# |j                          d {  7   w xY wwNmethod)nameurlr   )r   r   )r   r   r   r   r   )r   r   r   r   r
   handle_async_requestareadacloseselfr   r   r   r   r   requestresponses           N/root/.hermes/venv/lib/python3.12/site-packages/httpcore2/_async/interfaces.pyr   zAsyncRequestInterface.request   s      vH5#E*!'	: *'sGL!
 227;;	$.."""//### <"#(//###sZ   AB8BB8"B 5B6B :B8BB8B B8B5.B1/B55B8c              H  K   t        |d      }t        |d      }t        |d      }t        |||      }t	        |||||      }| j                  |       d {   }	 | |j                          d {    y 7 #7 # |j                          d {  7   w xY wwr   )r   r   r   r   r
   r   r   r   s           r!   streamzAsyncRequestInterface.stream5   s      vH5#E*!'	: *'sGL!
 227;;	$N//###	 < $(//###sH   AB"B B""B 'B":B;B"B"BBBB"c                   K   t               wNNotImplementedError)r   r   s     r!   r   z*AsyncRequestInterface.handle_async_requestT        !##   )r   bytes | strr   URL | bytes | strr   r   r   *bytes | typing.AsyncIterator[bytes] | Noner   Extensions | Nonereturnr   )r   r*   r   r+   r   r   r   r,   r   r-   r.   zAsyncGenerator[Response])r   r
   r.   r   )__name__
__module____qualname__r   
contextlibasynccontextmanagerr#   r        r!   r   r      s      $>B(, 
  < & 
> ##  $>B(,$$ $
 $ <$ &$ 
"$ $$<$r5   r   c                  T    e Zd ZddZddZddZddZddZddZddZ	ddZ
dd	Zy
)AsyncConnectionInterfacec                   K   t               wr%   r&   r   s    r!   r   zAsyncConnectionInterface.acloseY   r(   r)   c                    t               r%   r&   r9   s    r!   infozAsyncConnectionInterface.info\       !##r5   c                    t               r%   r&   )r   origins     r!   can_handle_requestz+AsyncConnectionInterface.can_handle_request_   r<   r5   c                $    | j                          S )a  
        Return `True` if the connection is open (the underlying socket has been
        established).  A connection in the NEW state (just created but not yet
        connected) returns `False`.

        Note: for some implementations `is_connected() != not is_closed()`.
        The default implementation returns `not self.is_closed()`, which is
        correct for connections that are never in the NEW (pre-TCP) state.
        )	is_closedr9   s    r!   is_connectedz%AsyncConnectionInterface.is_connectedb   s     >>###r5   c                    t               )a  
        Return `True` if the connection is currently able to accept an
        outgoing request.

        An HTTP/1.1 connection will only be available if it is currently idle.

        An HTTP/2 connection will be available so long as the stream ID space is
        not yet exhausted, and the connection is not in an error state.

        While the connection is being established we may not yet know if it is going
        to result in an HTTP/1.1 or HTTP/2 connection. The connection should be
        treated as being available, but might ultimately raise `NewConnectionRequired`
        required exceptions if multiple requests are attempted over a connection
        that ends up being established as HTTP/1.1.
        r&   r9   s    r!   is_availablez%AsyncConnectionInterface.is_availablen   s      "##r5   c                    t               )z
        Return `True` if the connection is in a state where it should be closed.

        This either means that the connection is idle and it has passed the
        expiry time on its keep-alive, or that server has sent an EOF.
        r&   r9   s    r!   has_expiredz$AsyncConnectionInterface.has_expired        "##r5   c                    t               )zD
        Return `True` if the connection is currently idle.
        r&   r9   s    r!   is_idlez AsyncConnectionInterface.is_idle   s     "##r5   c                     y)z
        Return `True` if the connection can serve multiple requests
        concurrently, such as an established HTTP/2 connection.

        The default covers HTTP/1.1-style implementations, which serve a
        single request at a time.
        Fr4   r9   s    r!   can_multiplexz&AsyncConnectionInterface.can_multiplex   s     r5   c                    t               )z
        Return `True` if the connection has been closed.

        Used when a response is closed to determine if the connection may be
        returned to the connection pool or not.
        r&   r9   s    r!   rA   z"AsyncConnectionInterface.is_closed   rG   r5   N)r.   None)r.   str)r>   r	   r.   bool)r.   rO   )r/   r0   r1   r   r;   r?   rB   rD   rF   rI   rK   rA   r4   r5   r!   r7   r7   X   s/    $$$
$$$$$$r5   r7   )
__future__r   r2   typingcollections.abcr   _modelsr   r   r   r	   r
   r   r   r   r   r   r   r7   r4   r5   r!   <module>rT      s<    "   *  @$ @$FH$4 H$r5   