o
    c                     @   s   d Z ddlmZ ddlmZ ddlmZ ddlmZ er#ddlmZ	 nddlm
Z	 d Z Z Z ZZG d	d
 d
eZdd Zee	e ddd ddlmZ eee ejd zejZW n eyh   e ZY nw edf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.
    )PY3)PY311)	exc_clear)copy_globals)_socket3)_socket2 c                   @   s   e Zd ZdZdS )errorN)__name__
__module____qualname__errnor   r   r   C/var/www/chikooza/env/lib/python3.10/site-packages/gevent/socket.pyr	       s    r	   c                  G   s   t  )N)NotImplementedError)argsr   r   r   getfqdn$   s   r   )__implements____dns____all____extensions____imports__
__socket__F)dunder_names_to_keepcleanup_globs)_socketcommon)
only_namesNc                 K   sr  d}t r
|dd}|rtd|| \}}g }tt||dt}|s&td|D ]}	|	\}
}}}}d}zt|
||}|turC|	| |rJ|
| || W nV ty } z9|s^|g}n|| ~|durl|  d}|	|d u r|s||dd=  ztd||dd= w t  W Y d}~q(d}~w ty   |dur|  d} w |dd= z|W d}  S d}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.
    F
all_errorsz/Too many keyword arguments to create_connectionr   z!getaddrinfo returns an empty listNzcreate_connection failed)r   pop	TypeErrorlistgetaddrinfoSOCK_STREAMr	   socket_GLOBAL_DEFAULT_TIMEOUT
settimeoutbindconnectappendcloseExceptionGroupr   BaseException)addresstimeoutsource_addresskwargsr   hostport
exceptionsaddrsresafsocktypeproto
_canonnamesasockexcr   r   r   create_connection?   s`   







r<   )__doc__gevent._compatr   r   r   gevent._utilr   geventr   _sourcer   r   r   r   r   r   	Exceptionr	   r   globalsr   r   r$   AttributeErrorobjectr<   r   r   r   r   <module>   s4   


f