U
    <{f
                     @   s   U d dl mZ d dlZd dlmZmZmZmZ da	i Z
eeef ed< dZG dd dejjZeedd	d
ZedddZedddZeedddZdS )    )DictN)BackendDatagramSocketSocketStreamSocket	_backendsFc                   @   s   e Zd ZdS )AsyncLibraryNotFoundErrorN)__name__
__module____qualname__ r   r   O/var/www/html/Darija-Ai-API/env/lib/python3.8/site-packages/dns/asyncbackend.pyr      s   r   )namereturnc                 C   sd   t | }|r|S | dkr.ddl}|j }n*| dkrJddl}|j }ntd|  |t | < |S )zGet the specified asynchronous backend.

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

    Raises NotImplementedError if an unknown backend name is specified.
    Ztrior   Nasynciozunimplemented async backend )r   getZdns._trio_backendZ_trio_backendr   Zdns._asyncio_backendZ_asyncio_backendNotImplementedError)r   backenddnsr   r   r   get_backend   s    	
r   )r   c                  C   s   z@t r
tddl} z|  W W S  | jk
r<   tdY nX W nJ tk
r   ddl}z|  W Y dS  tk
r   tdY nX Y nX dS )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sniffioZcurrent_async_libraryr   r   get_running_loopRuntimeError)r   r   r   r   r   sniff7   s    r   c                   C   s   t rt S tt S )z6Get the default backend, initializing it if necessary.)_default_backendset_default_backendr   r   r   r   r   get_default_backendR   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   )typingr   Zdns.exceptionr   Zdns._asyncbackendr   r   r   r   r   r   str__annotations__r   	exceptionZDNSExceptionr   r   r   r   r   r   r   r   r   <module>   s    	