
    Mpj"                     @   S r SSK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  SSS	S
.rSrSrSrSrSrSrS rS rS rS r\R2                  R5                  S\\/5      S 5       r\R2                  R5                  S\S4\S4\S4\S4/5      S 5       rg)zCTests for the minimum dependencies in README.rst and pyproject.toml    N)defaultdict)Path)dependent_packages)parse_version)z1.3.0install)z1.10.0zbuild, install)z3.0.1maintenance)joblibscipyz
conda-lockz
[project]
dependencies = ["joblib>=1.3.0", "scipy>=1.10.0"]
[project.optional-dependencies]
build = ["scipy>=1.10.0"]
install = ["joblib>=1.3.0", "scipy>=1.10.0"]
maintenance = ["conda-lock==3.0.1"]
[build-system]
requires = ["scipy>=1.10.0"]
a  
[project]
dependencies = ["joblib>=1.3.0,<2.0", "scipy>=1.10.0"]
[project.optional-dependencies]
build = ["scipy>=1.10.0,<1.19.0"]
install = ["joblib>=1.3.0,<2.0", "scipy>=1.10.0"]
maintenance = ["conda-lock==3.0.1"]
[build-system]
requires = ["scipy>=1.10.0,<1.19.0"]
z
[project]
dependencies = ["scipy<1.10.0"]
[project.optional-dependencies]
build = ["scipy>=1.10.0"]
install = ["scipy>=1.10.0"]
maintenance = ["conda-lock==3.0.1"]
[build-system]
requires = ["scipy>=1.10.0"]
z
[project]
dependencies = ["scipy>=1.10.0"]
[project.optional-dependencies]
build = ["scipy>=1.10.0"]
install = ["scipy>=1.10.0"]
maintenance = ["conda-lock==3.0.1"]
[build-system]
requires = ["scipy>=1.10.0"]
a$  
[project]
dependencies = ["joblib>=1.3.0", "scipy>=1.10.0"]
[project.optional-dependencies]
build = ["scipy>=1.10.0", "package_not_in_min_dependencies_py_file>=4.2"]
install = ["joblib>=1.3.0", "scipy>=1.10.0"]
maintenance = ["conda-lock==3.0.1"]
[build-system]
requires = ["scipy>=1.10.0"]
z
[project]
dependencies = ["joblib>=1.42.0", "scipy>=1.10.0"]
[project.optional-dependencies]
build = ["scipy>=1.10.0"]
install = ["joblib>=1.3.0", "scipy>=1.10.0"]
maintenance = ["conda-lock==3.0.1"]
[build-system]
requires = ["scipy>=1.10.0"]
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   zK has inconsistent minimum versions in README.rst and _min_dependencies.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
             f/var/www/html/pdf-tiff/venv/lib/python3.13/site-packages/sklearn/tests/test_min_dependencies_readme.pytest_min_dependencies_readmer)   Z   s   
 jj	(G w''(//66K,K77>>+&& 	;<			#	!DmmD)G&}}Q/q1AWmmoG,,'0+,>w,G,JK i  ..5Yd;-I  -6w6-#  
		s   AD41-D4"	D44
Ec                     [        [        5      nU R                  5        H3  u  nu  p4UR                  S5       H  nX   R	                  U5        M     M5     SSS.nU H  nSU 3nXvU'   M     UU4$ )Nz, buildr   )build-system.requireszproject.dependencieszproject.optional-dependencies.)r   listitemssplitappend)	dependencies0min_dependencies_tag_to_packages_without_versionr$   r&   tagst)pyproject_section_to_min_dependencies_tagtagsections	            r(   #extract_packages_and_pyproject_tagsr8      s    7B47H4(4(:(:(<$$+D!A<?FFwO " )=
 ") )1- @23%8=@': @
 	91     c                 ^   [        U5      u  p#UR                  5        GH  u  pEUS:X  a  S/O/ nX%   nUR                  S5      nU n	U H  n
X   n	M	     0 nSnU	 HT  n[        R                  " X5      nUc  [        U SU< S35      eUR                  S5      UR                  S5      nnUX'   MV     S	U S
3n[        U5      [        U5      :X  d   U5       eUR                  5        H?  u  nn[        U5      n[        X   S   5      nX;   a  M(  U SU SU 3nUU:X  a  M:   U5       e   GM     g )Nr,   numpy.z([\w-]+)\s*[>=]=\s*([\d\w.]+)z does not match expected regex z7. Only >= and == are supported for version requirementsr   r   zPackages in z! differ from _min_dependencies.pyr   zO has inconsistent minimum versions in pyproject.toml and _min_dependencies.py: r   )	r8   r.   r/   r   searchNotImplementedErrorr   sortedr   )pyproject_tomlmin_dependenciespackagespyproject_tagspyproject_sectionmin_dependencies_tagskip_version_check_forexpected_packagespyproject_section_keysinfokeypyproject_build_min_versionsr   requirementr   r$   r%   msgexpected_min_versionr'   s                       r(   check_pyproject_sectionsrO      s   BCSTH3A3G3G3I/
 +.EEWI2 	 %:!2!8!8!=)C9D * (*$2KIIg3E})"m#B7+ NL L 
  %{{1~u{{1~WG4;(1   .//PQ23v>O7PPURUUP < B B DGW#G,G#01A1J11M#N 0 ) **1$7K6LN  22;G;2 !EG 4Jr9   c                  `   [        [        R                  5      R                  R                  n U S-  nUR	                  5       (       d  [
        R                  " S5        UR                  S5       n[        R                  " U5      nSSS5        [        W[        5        g! , (       d  f       N= f)zFCheck versions in pyproject.toml is consistent with _min_dependencies.zpyproject.tomlz pyproject.toml is not available.rbN)r   r   r   r   r   r   r   r   tomllibloadrO   r   )root_directorypyproject_toml_pathr!   r@   s       r(   $test_min_dependencies_pyproject_tomlrV      s     '**+2299N(+;;%%'' 	67		!	!$	'1 a 
( ^-?@ 
(	's   /B
B-example_pyprojectc                 P    [         R                  " U 5      n[        U[        5        g)z-Test the version check for matching packages.N)rR   loadsrO   TOY_MIN_DEPENDENCIES_PY_INFO)rW   r@   s     r(   %test_check_matching_pyproject_sectionr[      s     ]]#45N^-IJr9   z)example_non_matching_pyproject, error_msgzZ.* does not match expected regex .*. Only >= and == are supported for version requirementsz/Packages in .* differ from _min_dependencies.pyzY.* has inconsistent minimum versions in pyproject.toml and _min_dependencies.py: .* != .*c                     [         R                  " U 5      n[        R                  " [        US9   [        U[        5        SSS5        g! , (       d  f       g= f)z>Test the version check for non-matching packages and versions.)r   N)rR   rY   r   raises	ExceptionrO   rZ   )example_non_matching_pyproject	error_msgr@   s      r(   )test_check_non_matching_pyproject_sectionra      s8    8 ]]#ABN	y		2 1MN 
3	2	2s   A


A)__doc__r   r   rR   collectionsr   pathlibr   r   r   sklearn._min_dependenciesr   sklearn.utils.fixesr   rZ   TOY_MATCHING_PYPROJECT_SECTIONS0TOY_MATCHING_PYPROJECT_SECTIONS_WITH_UPPER_BOUND#TOY_WRONG_SYMBOL_PYPROJECT_SECTIONS&TOY_MISSING_PACKAGE_PYPROJECT_SECTIONS)TOY_ADDITIONAL_PACKAGE_PYPROJECT_SECTIONS+TOY_NON_MATCHING_VERSION_PYPROJECT_SECTIONSr)   r8   rO   rV   markparametrizer[   ra    r9   r(   <module>rp      s   I 	 	  #    8 -
 #)*  	# 	4 0	' #	* &	- )	/ +&7R(0<fA" '8KK / 0D	
 3=	

 6=	

 8.	
.O/.Or9   