ó
    pyüi>	  ã                   ód   • S r SSKrSSKrSSKJr  SSKJr  \(       a  SSKJr  SSS	\	S
\	S\
4S jrg)zz
Helpful utility functions and classes in relation to exploring API endpoints
with the aim for a user-friendly interface.
é    N)ÚTYPE_CHECKINGé   )ÚModelCardData)Ú	ModelInfoÚ
model_infor   Úminimum_thresholdÚmaximum_thresholdÚreturnc                 ó¸  • Uc  Uc  [        S5      eUc  SnUc  [        R                  n[        U SS5      nUb  [	        U[
        [        45      (       d  gUR                  SS5      n[	        U[
        5      (       a  US   nU(       d  g[        R                  " S[        U5      5      nUc  g[        UR                  S	5      5      nXs=:*  =(       a    U:*  $ s  $ )
aµ  Checks if a model's emission is within a given threshold.

Args:
    model_info (`ModelInfo`):
        A model info object containing the model's emission information.
    minimum_threshold (`float`):
        A minimum carbon threshold to filter by, such as 1.
    maximum_threshold (`float`):
        A maximum carbon threshold to filter by, such as 10.

Returns:
    `bool`: Whether the model's emission is within the given threshold.
NzFBoth `minimum_threshold` and `maximum_threshold` cannot both be `None`éÿÿÿÿÚ	card_dataFÚco2_eq_emissionsÚ	emissionsz\d+\.\d+|\d+r   )Ú
ValueErrorÚmathÚinfÚgetattrÚ
isinstanceÚdictr   ÚgetÚreÚsearchÚstrÚfloatÚgroup)r   r   r	   r   ÚemissionÚmatchedÚemission_values          Úc/home/mande/repo/quber/.venv/lib/python3.13/site-packages/huggingface_hub/utils/endpoint_helpers.pyÚ_is_emission_within_thresholdr       sÙ   € ð Ñ Ð%6Ñ%>ÜÐaÓbÐbØÑ ØÐØÑ Ü ŸH™HÐä˜
 K°Ó6€IØÑ¤
¨9´t¼]Ð6K× LÑ LØð �}‰}Ð/°Ó6€HÜ�(œD×!Ñ!Ø˜KÑ(ˆÞØô �iŠi˜¬¨X«Ó7€GØ�Øä˜7Ÿ=™=¨Ó+Ó,€NØ×CÓCÐ2CÑCÐCÑCÐCó    )Ú__doc__r   r   Útypingr   Úrepocard_datar   Úhf_apir   r   Úboolr    © r!   r   Ú<module>r(      sH   ðñó
 Û 	Ý  å )ö Ý"ð&D¨kð &DÈeð &DÐhmð &DÐrvõ &Dr!   