
    nbi,                        d dl mZ d dlZd dlZd dlZej        rddlmZmZ ddl	m
Z
 ddlmZ ddlmZ dd	lmZ d#dZeddej        fd$dZd%dZd&d!Zd'd"Z e            ZdS )(    )annotationsN   )_TYPE_SOCKET_OPTIONS_TYPE_TIMEOUT_INTERNAL)HTTPConnection)AsyncHTTPConnection)AsyncSocket   )_DEFAULT_TIMEOUTconn$HTTPConnection | AsyncHTTPConnectionreturnboolc                    | j          S )z
    Returns True if the connection is dropped and should be closed.
    :param conn: :class:`urllib3.connection.HTTPConnection` object.
    )is_connected)r   s    n/var/www/html/mdtn/previsions/meteo_cartes/venv/lib/python3.11/site-packages/urllib3_future/util/connection.pyis_connection_droppedr      s            addresstuple[str, int]timeoutr   source_addresstuple[str, int] | Nonesocket_options_TYPE_SOCKET_OPTIONS | Nonesocket_kindsocket.SocketKindsocket.socketc                    t          j        dt          d           ddlm} |                    d                                                              | ||||          S )ak  Connect to *address* and return the socket object.

    Convenience function.  Connect to *address* (a 2-tuple ``(host,
    port)``) and return the socket object.  Passing the optional
    *timeout* parameter will set the timeout on the socket instance
    before attempting to connect.  If no *timeout* is supplied, the
    global default timeout setting returned by :func:`socket.getdefaulttimeout`
    is used.  If *source_address* is set it must be a tuple of (host, port)
    for the socket to bind as a source address before making the connection.
    An host of '' or port 0 tells the OS to use the default.
    zutil.connection.create_connection() is deprecated and scheduled for removal in a next major of urllib3.future. Use contrib.resolver from now on to manually create connection.r   )
stacklevel)ResolverDescriptionz	system://)r   r   r   r   )warningswarnDeprecationWarningcontrib.resolverr!   from_urlnewcreate_connection)r   r   r   r   r   r!   s         r   r(   r(      s    $ M	J	    766666 	$$[11			))# 
 

 


r   socksocket.socket | AsyncSocketoptionsNonec                   |d S |D ]}t          |          dk    r | j        t          j        k    r | j        |  5t          |          dk    ru|d                                         }|dk    r(| j        t          j        k    r | j        |d d           |dk    r'| j        t          j        k    r | j        |d d           d S )N      tcpudp)lentypesocketSOCK_STREAM
setsockoptlower
SOCK_DGRAM)r)   r+   optprotocols       r   _set_socket_optionsr;   C   s      * *s88q==TY&*<<<DOS!!!XX]]FLLNNH5  TY&2D%D%DRaR)))U""tyF4E'E'ERaR))* *r   socket.AddressFamilyc                 D    t           j        } t          rt           j        } | S )zThis function is designed to work in the context of
    getaddrinfo, where family=socket.AF_UNSPEC is the default and
    will perform a DNS search for both IPv6 and IPv4 records.)r4   AF_INETHAS_IPV6	AF_UNSPEC)familys    r   allowed_gai_familyrB   T   s     
 ^F "!Mr   c                     d} d}t           j        rG	 t          j         t           j                  } |                     d           d}n# t          $ r Y nw xY w| r|                                  |S )z4Returns True if the system can bind an IPv6 address.NF)z::1r   T)r4   has_ipv6AF_INET6bind	Exceptionclose)r)   rD   s     r   	_has_ipv6rI   _   s    DH 	=11DIIj!!!HH 	 	 	D	  

Os   5A 
AA)r   r   r   r   )r   r   r   r   r   r   r   r   r   r   r   r   )r)   r*   r+   r   r   r,   )r   r<   )r   r   )
__future__r   r4   typingr"   TYPE_CHECKING_typingr   r   
connectionr   _async.connectionr   contrib.ssar	   r   r   r   r5   r(   r;   rB   rI   r?    r   r   <module>rR      s)   " " " " " "   	 *FFFFFFFF++++++777777)))))) % % % % % %! ! ! ! '7-126%+%7% % % % %P* * * *"      . 9;;r   