Ë
    ÜÍ:j  ã                   ó  — d dl Z d dlmZ d dlZd dlZd dlmZmZmZ d dlm	Z	 d dl
mZmZ d„ Zd„ Zd„ Zd	„ Zej"                  j%                  d
g d¢«      d„ «       Zej"                  j)                  e	d¬«      d„ «       Zd„ Zy)é    N)ÚThreadPoolExecutor)Úconfig_contextÚ
get_configÚ
set_config)Ú_IS_WASM)ÚParallelÚdelayedc                  ób  — t        «       ddddddddddddœk(  sJ ‚t        d¬	«       t        «       d
   du sJ ‚t        d¬	«      5  t        «       ddddddddddddœk(  sJ ‚	 d d d «       t        «       d
   du sJ ‚t        d¬	«      5  t        d ¬	«      5  t        «       d
   du sJ ‚	 d d d «       t        «       d
   du sJ ‚t        d¬	«      5  t        «       d
   du sJ ‚t        d ¬	«      5  t        «       d
   du sJ ‚t        d¬	«       t        «       d
   du sJ ‚	 d d d «       t        «       d
   du sJ ‚	 d d d «       t        «       d
   du sJ ‚	 d d d «       t        «       ddddddddddddœk(  sJ ‚t        j                  t
        «      5  t        d«       d d d «       t        j                  t
        «      5  t        d¬«      j                  «        d d d «       y # 1 sw Y   �Œ{xY w# 1 sw Y   �ŒCxY w# 1 sw Y   ŒÜxY w# 1 sw Y   ŒÎxY w# 1 sw Y   ŒÀxY w# 1 sw Y   Œ„xY w# 1 sw Y   y xY w)NFi   TÚdiagramé   ÚdefaultÚspmatrix)Úassume_finiteÚworking_memoryÚprint_changed_onlyÚdisplayÚarray_api_dispatchÚpairwise_dist_chunk_sizeÚenable_cython_pairwise_distÚtransform_outputÚenable_metadata_routingÚskip_parameter_validationÚsparse_interface©r   r   ©Údo_something_else)r   r   r   ÚpytestÚraisesÚ	TypeErrorÚ	__enter__© ó    ún/home/mcse/projects/srt_converter/srt-converter-venv/lib/python3.12/site-packages/sklearn/tests/test_config.pyÚtest_config_contextr$      s‚  € Ü‹<ØØØ"ØØ#Ø$'Ø'+Ø%Ø#(Ø%*Ø&ñò ð ð ô  Õ&Ü‹<˜Ñ(¨EÑ1Ð1Ð1ä	 dÔ	+ñ 
Ü‹|Ø!Ø"Ø"&Ø Ø"'Ø(+Ø+/Ø )Ø',Ø).Ø *ñ 
ò 
ð 	
ñ 
÷
ô ‹<˜Ñ(¨EÑ1Ð1Ð1ä	 dÔ	+ñ 5Ü¨$Ô/ñ 	9Ü“< Ñ0°DÑ8Ð8Ñ8÷	9ô ‹|˜OÑ,°Ñ4Ð4Ð4ä¨%Ô0ñ 	:Ü“< Ñ0°EÑ9Ð9Ð9ä¨dÔ3ñ =Ü!“| OÑ4¸Ñ=Ð=Ð=ô ¨Õ.Ü!“| OÑ4¸Ñ<Ð<Ñ<÷=ô “< Ñ0°EÑ9Ð9Ñ9÷	:ô ‹|˜OÑ,°Ñ4Ð4Ñ4÷'5ô* ‹<ØØØ"ØØ#Ø$'Ø'+Ø%Ø#(Ø%*Ø&ñò ð ð ô 
�‰”yÓ	!ñ Ü�tÔ÷ô 
�‰”yÓ	!ñ ;Ü¨Ô.×8Ñ8Ô:÷;ð ;÷q
ñ 
ú÷"	9ñ 	9ú÷=ð =ú÷	:ð 	:ú÷5ð 5ú÷Hð ú÷;ð ;úsx   ÁGÂHÂG(Â'%HÃHÃ*/G5ÄHÄ4HÆ
HÆ7H%ÇG%Ç(G2	Ç-HÇ5G>Ç:HÈH
	ÈHÈHÈH"È%H.c                  óÒ   — t        «       d   du sJ ‚	 t        d¬«      5  t        «       d   du sJ ‚t        «       ‚# 1 sw Y   nxY wn# t        $ r Y nw xY wt        «       d   du sJ ‚y )Nr   FTr   )r   r   Ú
ValueErrorr!   r"   r#   Útest_config_context_exceptionr'   [   s   € Ü‹<˜Ñ(¨EÑ1Ð1Ð1ðÜ¨$Ô/ñ 	Ü“< Ñ0°DÑ8Ð8Ð8Ü“,Ð÷	ð 	úð 	øô ò Ùðúä‹<˜Ñ(¨EÑ1Ð1Ñ1s    “A Ÿ;»AÁ A Á	AÁAc                  ó‚  — t        «       d   du sJ ‚t        d ¬«       t        «       d   du sJ ‚t        d¬«       t        «       d   du sJ ‚t        d ¬«       t        «       d   du sJ ‚t        d¬«       t        «       d   du sJ ‚t        j                  t        «      5  t        d¬«       d d d «       y # 1 sw Y   y xY w)Nr   Fr   Tr   )r   r   r   r   r   r!   r"   r#   Útest_set_configr)   f   s¶   € Ü‹<˜Ñ(¨EÑ1Ð1Ð1Ü˜TÕ"Ü‹<˜Ñ(¨EÑ1Ð1Ð1Ü˜TÕ"Ü‹<˜Ñ(¨DÑ0Ð0Ð0Ü˜TÕ"Ü‹<˜Ñ(¨DÑ0Ð0Ð0Ü˜UÕ#Ü‹<˜Ñ(¨EÑ1Ð1Ð1ô 
�‰”yÓ	!ñ +Ü TÕ*÷+÷ +ñ +ús   ÂB5Â5B>c                 óŠ   — t        | ¬«      5  t        j                  |«       t        «       d   cddd«       S # 1 sw Y   yxY w)zAReturn the value of assume_finite after waiting `sleep_duration`.r   r   N)r   ÚtimeÚsleepr   )r   Úsleep_durations     r#   Úset_assume_finiter.   v   s5   € ä	 mÔ	4ñ -Ü�
‰
�>Ô"Ü‹|˜OÑ,÷-÷ -ò -ús	   �"9¹AÚbackend)ÚlokyÚmultiprocessingÚ	threadingc                 ón   — g d¢}g d¢} t        | d¬«      d„ t        ||«      D «       «      }|g d¢k(  sJ ‚y)ao  Test that the global config is threadsafe with all joblib backends.
    Two jobs are spawned and sets assume_finite to two different values.
    When the job with a duration 0.1s completes, the assume_finite value
    should be the same as the value passed to the function. In other words,
    it is not influenced by the other job setting assume_finite to True.
    ©FTFT©çš™™™™™¹?çš™™™™™É?r6   r7   é   )r/   Ún_jobsc              3   óN   K  — | ]  \  }} t        t        «      ||«      –— Œ y ­w)N)r	   r.   )Ú.0r   Ú	sleep_durs      r#   ú	<genexpr>z0test_config_threadsafe_joblib.<locals>.<genexpr>ˆ   s+   è ø€ ò 0á$ˆM˜9ð 	#ŒÔ!Ó" =°)×<ñ0ùs   ‚#%N)r   Úzip)r/   Úassume_finitesÚsleep_durationsÚitemss       r#   Útest_config_threadsafe_joblibrB   }   sF   € ò 0€NÚ*€Oà/ŒH˜W¨QÔ/ñ 0ä(+¨N¸OÓ(Lô0ó €Eð
 Ò.Ò.Ð.Ñ.r"   zcannot start threads)Úreasonc                  óº   — g d¢} g d¢}t        d¬«      5 }|j                  t        | |«      D �cg c]  }|‘Œ }}ddd«       g d¢k(  sJ ‚yc c}w # 1 sw Y   ŒxY w)z©Uses threads directly to test that the global config does not change
    between threads. Same test as `test_config_threadsafe_joblib` but with
    `ThreadPoolExecutor`.r4   r5   r8   )Úmax_workersN)r   Úmapr.   )r?   r@   ÚeÚoutputrA   s        r#   Útest_config_threadsaferI   �   sp   € ò 0€NÚ*€Oä	¨Ô	*ð 
¨að Ÿ%™%Ô 1°>À?ÓSö
àò ð
ˆð 
÷
ð Ò.Ò.Ð.Ñ.ùò
÷
ð 
ús   •A¯	A¸AÁAÁAc                 óŠ  — | j                  t        j                  j                  j                  dd«       t        j                  t        d¬«      5  t        d¬«      5  	 ddd«       ddd«       t        j                  t        d¬«      5  t        d¬«       ddd«       y# 1 sw Y   ŒBxY w# 1 sw Y   ŒFxY w# 1 sw Y   yxY w)z!Check error when SciPy is too oldÚ__version__z1.13.0zSciPy must be 1.14.0 or newer)ÚmatchT)r   N)
ÚsetattrÚsklearnÚutilsÚ
_array_apiÚscipyr   r   ÚImportErrorr   r   )Úmonkeypatchs    r#   Ú*test_config_array_api_dispatch_error_scipyrT   ¢   s›   € à×ÑœŸ™×0Ñ0×6Ñ6¸ÀxÔPä	�‰”{Ð*IÔ	Jñ Ü¨tÔ4ñ 	Ø÷	÷ô 
�‰”{Ð*IÔ	Jñ ,Ü dÕ+÷,ð ,÷	ð 	ú÷ð ú÷,ð ,ús0   ÁB-ÁB!Á B-ÂB9Â!B*	Â&B-Â-B6Â9C)r+   Úconcurrent.futuresr   r   rN   r   r   r   Úsklearn.utils.fixesr   Úsklearn.utils.parallelr   r	   r$   r'   r)   r.   ÚmarkÚparametrizerB   ÚxfailrI   rT   r!   r"   r#   ú<module>r[      sˆ   ðÛ Ý 1ã ã ß :Ñ :Ý (ß 4òL;ò^2ò+ò -ð ‡�×Ñ˜Ò$LÓMñ/ó Nð/ð$ ‡�×Ñ�8Ð$:ÐÓ;ñ/ó <ð/ó"	,r"   