o
    2c                     @   sd   d dl Zd dlmZmZmZmZ dai ZdZ	G dd dej
jZdd Zdd	 Zd
d Zdd ZdS )    N)SocketDatagramSocketStreamSocketBackendFc                   @   s   e Zd ZdS )AsyncLibraryNotFoundErrorN)__name__
__module____qualname__ r
   r
   F/var/www/html/gps/gps/lib/python3.10/site-packages/dns/asyncbackend.pyr      s    r   c                 C   s   t | }|r	|S | dkrddl}|j }n#| dkr%ddl}|j }n| dkr3ddl}|j }nt	d|  |t | < |S )zGet the specified asychronous backend.

    *name*, a ``str``, the name of the backend.  Currently the "trio",
    "curio", and "asyncio" backends are available.

    Raises NotImplementError if an unknown backend name is specified.
    trior   Ncurioasynciozunimplemented async backend )
	_backendsgetdns._trio_backend_trio_backendr   dns._curio_backend_curio_backenddns._asyncio_backend_asyncio_backendNotImplementedError)namebackenddnsr
   r
   r   get_backend   s   
	r   c                  C   s   zt rtddl} z|  W W S  | jy   tdw  tyM   ddl}z|  W Y dS  ty9   td tyL   |j	
 sHtdY Y dS w w )zAttempt to determine the in-use asynchronous I/O library by using
    the ``sniffio`` module if it is available.

    Returns the name of the library, or raises AsyncLibraryNotFoundError
    if the library cannot be determined.
    r   Nz&sniffio cannot determine async libraryr   zno async library detected)_no_sniffioImportErrorsniffiocurrent_async_libraryr   r   get_running_loopRuntimeErrorAttributeErrorTaskcurrent_task)r   r   r
   r
   r   sniff2   s,   
r%   c                   C   s   t rt S tt S )z;Get the default backend, initializing it if necessary.
    )_default_backendset_default_backendr%   r
   r
   r
   r   get_default_backendQ   s   
r(   c                 C   s   t | atS )a,  Set the default backend.

    It's not normally necessary to call this method, as
    ``get_default_backend()`` will initialize the backend
    appropriately in many cases.  If ``sniffio`` is not installed, or
    in testing situations, this function allows the backend to be set
    explicitly.
    )r   r&   )r   r
   r
   r   r'   Z   s   
r'   )dns.exceptionr   dns._asyncbackendr   r   r   r   r&   r   r   	exceptionDNSExceptionr   r   r%   r(   r'   r
   r
   r
   r   <module>   s   	