
    ig                     <   d Z ddlmZ ddlmZ ddlmZ ddlmZ dxZ	xZ
xZxZZ G d de          Zd	 Z ee e            d
d           ddlmZ  ee e            ej                   	 ej        Zn# e$ r  e            ZY nw xY wedfdddZee_        dS )a  Cooperative low-level networking interface.

This module provides socket operations and some related functions.
The API of the functions and classes matches the API of the corresponding
items in the standard :mod:`socket` module exactly, but the synchronous functions
in this module only block the current greenlet and let the others run.

For convenience, exceptions (like :class:`error <socket.error>` and :class:`timeout <socket.timeout>`)
as well as the constants from the :mod:`socket` module are imported into this module.
    )PY311)	exc_clear)copy_globals)_socket3 c                       e Zd ZdZdS )errorN)__name__
__module____qualname__errnor       8/usr/local/lib/python3.11/dist-packages/gevent/socket.pyr	   r	      s        EEEr   r	   c                      t                      )N)NotImplementedError)argss    r   getfqdnr   #   s    


r   )__implements____dns____all____extensions____imports__
__socket__F)dunder_names_to_keepcleanup_globs)_socketcommon)
only_namesN)
all_errorsc                   t           sd}| \  }}g }t          t          ||dt                              }|st	          d          |D ]"}|\  }	}
}}}d}	 t          |	|
|          }|t          ur|                    |           |r|                    |           |	                    |           |dd= 	 |d}c S # d}w xY w# t          $ ry}|s|g}n|
                    |           ~||                                 d}||d         u r#|s|dd=  	 t          d|          # |dd= w xY wt                       Y d}~d}~wt          $ r ||                                 d} w xY wdS )a  
    create_connection(address, timeout=None, source_address=None, *, all_errors=False) -> socket

    Connect to *address* and return the :class:`gevent.socket.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:`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. A host of '' or port 0 tells
    the OS to use the default.

    .. versionchanged:: 20.6.0
        If the host part of the address includes an IPv6 scope ID,
        it will be used instead of ignored, if the platform supplies
        :func:`socket.inet_pton`.
    .. versionchanged:: 22.08.0
        Add the *all_errors* argument. This only has meaning on Python 3.11+;
        it is a programming error to pass it on earlier versions.
    .. versionchanged:: 23.7.0
        You can pass a value for ``all_errors`` on any version of Python.
        It is forced to false for any version before 3.11 inside the function.
    Fr   z!getaddrinfo returns an empty listNzcreate_connection failed)r   listgetaddrinfoSOCK_STREAMr	   socket_GLOBAL_DEFAULT_TIMEOUT
settimeoutbindconnectappendcloseExceptionGroupr   BaseException)addresstimeoutsource_addressr   hostport
exceptionsaddrsresafsocktypeproto
_canonnamesasockexcs                   r   create_connectionr<   >   s   B  
JD$J T4K8899E 97888 6 6.1+HeZ3	"h..D555((( *		.)))LLR 111tW  	 	 	 '!U

!!#&&&

DeBi! "111& ))CZPPP #111%%%% KKKKKKKK 	 	 	 

D	Q6 6s8   AC7B==C
E)AED%%D,,E'E))__doc__gevent._compatr   r   gevent._utilr   geventr   _sourcer   r   r   r   r   	Exceptionr	   r   globalsr   r   r%   AttributeErrorobjectr<   r   r   r   <module>rF      s  	 	 !           $ $ $ $ $ $ % % % % % % ' & & & & &
 EG F F F7 F^k    I         Wggii#R " " " " !           ]GGII%46 6 6 6'(@ ' ' '$fhh' (?t b!&b b b b bP .   s   /A7 7B	B	