
    Pi                        d Z ddlZddlZddlmZ ddlmZ ddlZddlZddl	m
Z
 ddlmZ  ee          Z e
j                    D ];\  Z\  ZZe                    d          D ]Zee                             e           <dd	d
ZeD ]Zde Zeee<   d Z	 ddZej                            de                                          d             ZdS )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                     t          j        d          } t          t          j                  j        j        }|dz  }t          j                            |          st          j
        d           |                    d          5 }|D ]}|                     |          }|s|                    d          |                    d          }}|                                }|t          v rIt!          |          }t!          t          |         d                   }| d| d	| }	||k    s
J |	            	 d d d            d S # 1 swxY w Y   d S )
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
             ~/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/sklearn/tests/test_min_dependencies_readme.pytest_min_dependencies_readmer'      s   
 j	( G w'((/6K,K7>>+&& = 	;<<<			#		 7! 	7 	7DmmD))G &}}Q//q1A1AWGmmooG,,,'00+,>w,G,JKK  F F+2F F8CF F  +---w---#	77 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7s   B.EEEc                    t          j        d          }|g }t          |         }t          t          j                  j        j        }|dz  }|                                st          j        d           |	                    d          5 }|
                    |          }d d d            n# 1 swxY w Y   |                     d          }	|}
|	D ]
}|
|         }
i }d}|
D ]]}t          j        ||          }|t          | d|d          |                    d	          |                    d
          }}|||<   ^t!          |          t!          |          k    sJ |                                D ]S\  }}t%          |          }t%          t&          |         d                   }||v r9| d| d| }||k    s
J |            Td S )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9N(+;;%%'' 8 	6777		!	!$	'	' )1 a) ) ) ) ) ) ) ) ) ) ) ) ) ) ) /44S99D%  Cy#%  /G 
8 
8	';//=% H Hw H H H  
 !;;q>>5;;q>>07$W--.//6:K3L3LLLLL8>>@@ 
8 
8((,-?-H-KLL,,,  G G#*G G0DG G 	 ........
8 
8s   B--B14B1z'pyproject_section, min_dependencies_tagc                 @    |dk    rdgnd}t          | ||           dS )zFCheck versions in pyproject.toml is consistent with _min_dependencies.r   numpyN)r6   )rA   )r4   r5   r6   s      r&   $test_min_dependencies_pyproject_tomlrD      sD     +?'*I*IgYYt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 I 				 				 # # # # # #         8 8 8 8 8 8 - - - - - -0;D0A0A -&>&8&>&@&@ M M"G"k6d## M M5e<CCGLLLLM %%- - ) 9 = =C4s44G9<-g66&7 &7 &7T EI:8 :8 :8 :8z --3355 	 		 	 	 	rE   