U
    <æ{fP	  ã                   @   s¾   U d dl Zd dlZd dlZd dlmZmZmZ eedœdd„Z	ee
dœdd„Zi Zeee
f ed	< ee
d
œdd„Zee
ddœdd„ZdgdddgdgdgdgdgdœZeeee f ed< dS )é    N)ÚDictÚListÚTuple)ÚversionÚreturnc              	   C   sd   |   d¡}g }|D ]H}d t dd„ |¡¡}z| t|ƒ¡ W q tk
rX   Y  q\Y qX qt|ƒS )NÚ.Ú c                 S   s
   | t jkS )N)ÚstringÚdigits)Úx© r   úL/var/www/html/Darija-Ai-API/env/lib/python3.8/site-packages/dns/_features.pyÚ<lambda>   ó    z"_tuple_from_text.<locals>.<lambda>)ÚsplitÚjoinÚ	itertoolsÚ	takewhileÚappendÚintÚ	ExceptionÚtuple)r   Z
text_partsZ	int_partsZ	text_partZdigit_prefixr   r   r   Ú_tuple_from_text	   s    
ÿr   )Úrequirementr   c                 C   sV   |   d¡\}}ztj |¡}W n tk
r4   Y dS X t|ƒ}t|ƒ}||k rRdS dS )zeIs the requirement fulfilled?

    The requirement must be of the form

        package>=version
    z>=FT)r   Ú	importlibÚmetadatar   r   r   )r   ÚpackageÚminimumr   Z	t_versionZ	t_minimumr   r   r   Ú_version_check   s    	r   Ú_cache)Úfeaturer   c                 C   s^   t  | ¡}|dk	r|S t | ¡}|dkr4dt | < dS d}|D ]}t|ƒs<d} qRq<|t | < |S )zòIs *feature* available?

    This tests if all optional packages needed for the
    feature are available and recent enough.

    Returns ``True`` if the feature is available,
    and ``False`` if it is not or if metadata is
    missing.
    NFT)r   ÚgetÚ_requirementsr   )r    ÚvalueÚrequirementsÚokr   r   r   r   Úhave/   s    


r&   )r    Úenabledr   c                 C   s   |t | < dS )z«Force the status of *feature* to be *enabled*.

    This method is provided as a workaround for any cases
    where importlib.metadata is ineffective, or for testing.
    N)r   )r    r'   r   r   r   ÚforceJ   s    r(   zcryptography>=41zhttpcore>=1.0.0zhttpx>=0.26.0z	h2>=4.1.0zaioquic>=0.9.25z	idna>=3.6z
trio>=0.23z
wmi>=1.5.1)ZdnssecZdohZdoqÚidnaZtrioZwmir"   )Úimportlib.metadatar   r   r	   Útypingr   r   r   Ústrr   Úboolr   r   Ú__annotations__r&   r(   r"   r   r   r   r   Ú<module>   s$    þù