
    ,h\                        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 e	e
eeej                  eef   f      Zej                  rddlmZ ddZeddf	 	 	 	 	 	 	 	 	 dd	Z	 	 	 	 	 	 dd
ZddZddZ ed      Zy)    )annotationsN   )LocationParseError   )_DEFAULT_TIMEOUT_TYPE_TIMEOUT)BaseHTTPConnectionc                    | j                    S )z
    Returns True if the connection is dropped and should be closed.
    :param conn: :class:`urllib3.connection.HTTPConnection` object.
    )is_connected)conns    Y/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/urllib3/util/connection.pyis_connection_droppedr      s    
         c                ~   | \  }}|j                  d      r|j                  d      }d}t               }	 |j                  d       t        j                  |||t        j                        D ]r  }|\  }	}
}}}d}	 t        j                  |	|
|      }t        ||       |t        ur|j                  |       |r|j                  |       |j                  |       d}|c S  |	 |t        d      # t        $ r t        d| d      dw xY w# t        $ r}|}||j                          Y d}~d}~ww xY w# d}w xY w)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.
    [z[]Nidna'z', label empty or too longz!getaddrinfo returns an empty list)
startswithstripallowed_gai_familyencodeUnicodeErrorr   socketgetaddrinfoSOCK_STREAM_set_socket_optionsr   
settimeoutbindconnectOSErrorclose)addresstimeoutsource_addresssocket_optionshostporterrfamilyresafsocktypeproto	canonnamesasock_s                   r   create_connectionr2      sZ   $ JD$szz$
C
  !FQF !!$ff6H6HI -0*HeY	==Xu5D  n5..(		.)LLCK!. 	I
 9::C  Q 1TF*D!EFDPQ*  	C

	 Cs0   C1 :A#D$D8 1D	D5D00D58D<c                6    |y |D ]  } | j                   |   y )N)
setsockopt)r0   optionsopts      r   r   r   ]   s)      r   c                 R    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.)r   AF_INETHAS_IPV6	AF_UNSPEC)r)   s    r   r   r   g   s     
 ^^F!!Mr   c                    d}d}t         j                  r9	 t        j                   t         j                        }|j                  | df       d}|r|j                          |S # t        $ r Y w xY w)z4Returns True if the system can bind an IPv6 address.NFr   T)r   has_ipv6AF_INET6r   	Exceptionr!   )r&   r0   r<   s      r   	_has_ipv6r?   r   sf    DH	==1DIItQi H 

O  		s   8A" "	A.-A.z::1)r   r	   returnbool)
r"   ztuple[str, int]r#   r   r$   ztuple[str, int] | Noner%   _TYPE_SOCKET_OPTIONS | Noner@   socket.socket)r0   rC   r5   rB   r@   None)r@   zsocket.AddressFamily)r&   strr@   rA   )
__future__r   r   typing
exceptionsr   r#   r   r   listtupleintUnionbytes_TYPE_SOCKET_OPTIONSTYPE_CHECKING_base_connectionr	   r   r2   r   r   r?   r9    r   r   <module>rR      s    "   + 4E#sFLLe,D"DEF 	5! .-126	?;?;?; +?; 0	?;
 ?;D
"=	. Ur   