
    ITh>	                     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          ^/var/www/auris/envauris/lib/python3.13/site-packages/huggingface_hub/utils/endpoint_helpers.py_is_emission_within_thresholdr       s      %6%>abb   HH
K6I
9t]6K L L }}/6H(D!!K( iiX7G7==+,NCC2C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!   