L idZddlZddlZddlZddlZddlmZddlm Z ejejejejejejdZdZd dedeed dfd Zd Zy) z- Utilities for working with package versions N)Optional)version)=>c ||td|d|d|d|d t|tj|tj|st |d|d|d|y)NzUnable 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) ValueErroropsrparse ImportError)opgot_verwant_ver requirementpkghints a/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/transformers/utils/versions.py_compare_versionsr%s(*-k]'(7SZR[\ E $   r77==)7==+B Cm[\_[``bcjbkklmqlr s   Drrreturnc |d|nd}tjd|r|dd}}}ntjd|}|std||d\}}|j d}i}|D]k} tjd | }|std||d\}}|||<|t vs?t|d t t jd ||d k(rbd jtjddD cgc] } t| c} } jD]\}}t|| ||||y tjj!|} )jD]\}}t|| ||||yycc} w#tjj"$r&tjj#d|d|wxYw)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 zThe 'zB' distribution was not found and is required by this application. )rematchfindallr splitr listkeysjoinsys version_infostritemsr importlibmetadatarPackageNotFoundError) rrrrrr want_full want_rangewantedwxrs rrequire_versionr11s"*Rv;D xx-'tR PPZ[]Z^!_`` a h((C,<,r@s~   ++ ++ ++ ++    >M>MHSM>MT>MB.r