a
    PÒšh¼	  ã                   @   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g d¢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   sb   |   d¡}g }|D ]F}d t dd„ |¡¡}z| t|ƒ¡ W q tyV   Y  qZY q0 qt|ƒS )NÚ.Ú c                 S   s
   | t jv S )N)ÚstringÚdigits)Úx© r   úH/wd/webapps/venvs/v2025_4um/lib/python3.9/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   sb   |   d¡\}}ztj |¡}|du r*W dS W n ty@   Y dS 0 t|ƒ}t|ƒ}||k r^dS dS )zeIs the requirement fulfilled?

    The requirement must be of the form

        package>=version
    z>=NFT)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ur|S t | ¡}|du 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   Úhave2   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   ÚforceM   s    r(   zcryptography>=43)zhttpcore>=1.0.0zhttpx>=0.26.0z	h2>=4.1.0zaioquic>=1.0.0z	idna>=3.7z
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"   
þù