
    g                         d Z ddlZddlZddlZddlZddlmZ ddlm	Z	 ej
        ej        ej        ej        ej        ej        dZd Zddedee         d	dfd
Zd ZdS )z-
Utilities for working with package versions
    N)Optional)version)<z<===z!=z>=>c                     ||t          d| d| d| d| d	          t          |          t          j        |          t          j        |                    st	          | d| d| d|           d S )NzUnable to compare versions for z: need=z found=z). This is unusual. Consider reinstalling .z@ is required for a normal functioning of this module, but found r   )
ValueErroropsr   parseImportError)opgot_verwant_verrequirementpkghints         W/var/www/html/ai-engine/env/lib/python3.11/site-packages/transformers/utils/versions.py_compare_versionsr   %   s    (*$k $ $( $ $SZ $ $ $ $ $
 
 	
 r77=))7=+B+BCC 
ss\_sscjssmqss
 
 	

 
    r   r   returnc           	         |d| nd}t          j        d|           r| dd}}}nt          j        d|           }|st          d|            |d         \  }}|                    d          }i }|D ]}	t          j        d	|	          }|st          d|            |d         \  }}|||<   |t
          vr;t          |  d
t          t
                                                     d|           |dk    rad                    d t          j
        dd         D                       }
|                                D ]\  }}t          ||
|| ||           dS 	 t          j                            |          }
n=# t          j        j        $ r& t          j                            d|  d|           w xY w|.|                                D ]\  }}t          ||
|| ||           dS dS )a/  
    Perform a runtime check of the dependency versions, using the exact same syntax used by pip.

    The installed module version comes from the *site-packages* dir via *importlib.metadata*.

    Args:
        requirement (`str`): pip style definition, e.g.,  "tokenizers==0.9.4", "tqdm>=4.27", "numpy"
        hint (`str`, *optional*): what suggestion to print in case of requirements not being met

    Example:

    ```python
    require_version("pandas>1.1.2")
    require_version("numpy>1.18.5", "this is important to have for whatever reason")
    ```N
 z^[\w_\-\d]+$z^([^!=<>\s]+)([\s!=<>]{1,2}.+)zgrequirement needs to be in the pip package format, .e.g., package_a==1.23, or package_b>=1.23, but got r   ,z^([\s!=<>]{1,2})(.+)z: need one of z
, but got pythonr	   c                 ,    g | ]}t          |          S  )str).0xs     r   
<listcomp>z#require_version.<locals>.<listcomp>_   s    AAAqCFFAAAr      zThe 'zB' distribution was not found and is required by this application. )rematchfindallr
   splitr   listkeysjoinsysversion_infoitemsr   	importlibmetadatar   PackageNotFoundError)r   r   r   r   r   r%   	want_full
want_rangewantedwr   s              r   require_versionr5   1   s   " *;;;;D 
x-- a'tR
<kJJ 	&#& &   qY__S))
 
	a 
	aAJ6::E  . +. .   !8LB!F2J}} K!_!_tCHHJJ?O?O!_!_[]!_!_```  h((AAC,<RaR,@AAABB"LLNN 	M 	MLBb'8[#tLLLL
$,,S112 
 
 
 55iKiicgii
 
 	

 "LLNN 	M 	MLBb'8[#tLLLL 	M 	Ms   E; ;:F5c                 &    d}t          | |          S )zCrequire_version wrapper which emits a core-specific hint on failurez_Try: `pip install transformers -U` or `pip install -e '.[dev]'` if you're working with git main)r5   )r   r   s     r   require_version_corer7   r   s    lD;---r   )N)__doc__importlib.metadatar.   operatorr$   r+   typingr   	packagingr   ltleeqnegegtr   r   r   r5   r7   r   r   r   <module>rC      s          				 



             

+
+
+
+	 	
 	
 	
>M >M >MHSM >MT >M >M >M >MB. . . . .r   