
    9ie                         d dl Zd dlmZ d dlmZmZ ddlmZ  eej                  j                  d            Zdeeef   ded	efd
ZdedefdZy)    N)Union)Versionparse   )STR_OPERATION_TO_FUNCtorchlibrary_or_version	operationrequirement_versionc                 ,   |t        j                         vr,t        dt        t        j                                d|       t         |   }t	        | t
              r(t        t        j                  j                  |             }  || t        |            S )a  
    Compares a library version to some requirement using a given operation.

    Args:
        library_or_version (`str` or `packaging.version.Version`):
            A library name or a version to check.
        operation (`str`):
            A string representation of an operator, such as `">"` or `"<="`.
        requirement_version (`str`):
            The version to compare the library version against
    z`operation` must be one of z, received )
r   keys
ValueErrorlist
isinstancestrr   	importlibmetadataversion)r	   r
   r   s      c/var/www/html/backtest/airagagent/rag_env/lib/python3.12/site-packages/accelerate/utils/versions.pycompare_versionsr      s     -22446t<Q<V<V<X7Y6ZZefoepqrr%i0I$c*"9#5#5#=#=>P#QR'/B)CDD    r   c                 $    t        t        | |      S )a	  
    Compares the current PyTorch version to a given reference with an operation.

    Args:
        operation (`str`):
            A string representation of an operator, such as `">"` or `"<="`
        version (`str`):
            A string version of PyTorch
    )r   torch_version)r
   r   s     r   is_torch_versionr   .   s     M9g>>r   )importlib.metadatar   typingr   packaging.versionr   r   	constantsr   r   r   r   r   r   r    r   r   <module>r       sk      , , i((009:EsG|)< E Ecf E(
? 
?c 
?r   