
    /Цi                        S r SSKrSSKrSSKJr  SSKJr  SSKrSSKrSSK	J
r
  SSKJr  \" \5      r\
R                  " 5        H5  u  ru  rr\R'                  S5       H  r\\   R+                  \5        M     M7     SS	S
.r\ H  rS\ 3r\\\'   M     S r SS jr\R6                  R9                  S\R                  5       5      S 5       rg)zCTests for the minimum dependencies in README.rst and pyproject.toml    N)defaultdict)Path)dependent_packages)parse_versionz, buildinstall)zbuild-system.requireszproject.dependencieszproject.optional-dependencies.c                     [         R                  " S5      n [        [        R                  5      R
                  R
                  nUS-  n[        R                  R                  U5      (       d  [        R                  " S5        UR                  S5       nU H  nU R                  U5      nU(       d  M  UR                  S5      UR                  S5      pvUR                  5       nU[        ;   d  MZ  [!        U5      n[!        [        U   S   5      nU SU S	U 3n	Xx:X  a  M   U	5       e   S S S 5        g ! , (       d  f       g = f)
NzE\.\. \|([A-Za-z-]+)MinVersion\| replace::( [0-9]+\.[0-9]+(\.[0-9]+)?)z
README.rstz%The README.rst file is not available.r      r   zH has inconsistent minimum versions in README.rst and _min_depencies.py:  != )recompiler   sklearn__file__parentospathexistspytestskipopenmatchgrouplowerr   r   )
patternreadme_pathreadme_fileflinematchedpackageversionmin_versionmessages
             i/var/www/html/ai-image-ml/venv/lib/python3.13/site-packages/sklearn/tests/test_min_dependencies_readme.pytest_min_dependencies_readmer'      s   
 jj	(G w''(//66K,K77>>+&& 	;<			#	!DmmD)G&}}Q/q1AWmmoG,,'0+,>w,G,JK i  ++2)4}F  -6w6-#  
		s   AD41-D4"	D44
Ec                 d   [         R                  " S5      nUc  / n[        U   n[        [        R
                  5      R                  R                  nUS-  nUR                  5       (       d  [         R                  " S5        UR                  S5       nUR                  U5      nS S S 5        U R                  S5      n	Wn
U	 H  nX   n
M	     0 nSnU
 HU  n[        R                  " X5      nUc  [        U SU< S35      eUR                  S	5      UR                  S
5      nnUUU'   MW     [!        U5      [!        U5      :X  d   eUR#                  5        HE  u  nn[%        U5      n[%        [&        U   S   5      nUU;   a  M.  U SU SU 3nUU:X  a  M@   U5       e   g ! , (       d  f       GN= f)Ntomllibzpyproject.tomlz pyproject.toml is not available.rb.z([\w-]+)\s*[>=]=\s*([\d\w.]+)z does not match expected regex z7. Only >= and == are supported for version requirementsr   r   r   zL has inconsistent minimum versions in pyproject.toml and _min_depencies.py: r   )r   importorskip-min_depencies_tag_to_packages_without_versionr   r   r   r   r   r   r   loadsplitr   searchNotImplementedErrorr   sorteditemsr   r   )pyproject_sectionmin_dependencies_tagskip_version_check_forr)   expected_packagesroot_directorypyproject_toml_pathr   pyproject_tomlpyproject_section_keysinfokeypyproject_build_min_versionsr   requirementr   r"   r#   expected_min_versionr%   s                       r&   check_pyproject_sectionrA   E   s    !!),G%!#E '**+2299N(+;;%%'' 	67		!	!$	'1 a 
( /44S9D%y & $&  /G		'/=%->wk JH H 
 !;;q>5;;q>07$W-  ./6:K3LLLL8>>@(,-?-H-KL,, i ##*)40D/EG 	 ..77. A7 
(	's   F  
F/z'pyproject_section, min_dependencies_tagc                 0    US:X  a  S/OSn[        U UUS9  g)zFCheck versions in pyproject.toml is consistent with _min_dependencies.r   numpyN)r6   )rA   )r4   r5   r6   s      r&   $test_min_dependencies_pyproject_tomlrD      s&     +?'*IgYt5    )N)__doc__r   r   collectionsr   pathlibr   r   r   sklearn._min_dependenciesr   sklearn.utils.fixesr   listr-   r3   r"   r$   extrasr/   extraappend)pyproject_section_to_min_dependencies_tagtagsectionr'   rA   markparametrizerD    rE   r&   <module>rU      s    I 	 	 #    8 -0;D0A -&8&>&>&@"G"k6d#5e<CCGL $ 'A
 %%- ) 9C.se4G9<-g6 9
&7T EI:8z --335			rE   