
    Ug?              
          d dl Z d dlZd dlZd dlZd dlmZ d dlZd dlm	Z
 d dlZd dlZd dlmZ d dlmZ d dlmZmZ d dlmZ 	 d dlmZ dZn# e$ r d	ZY nw xY wd
 Zd Z ej        dd          d             ZdeiZer eee           r	 d dl!Z!e"                    de!i            ej#        e!j$                   ej%        d          k     r e&d           e!j'        d           n# e&$ r Y nw xY w	 d dl(Z(e"                    de(i            e(j)        e           n# e&$ r Y nw xY w	 d dl*Z*e"                    de*i           n# e&$ r Y nw xY w	 d dl+Z,e"                    de,j        i           e,j-        "                    dd           e,j-        "                    d e,j.        e          d                     n# e&$ r Y nw xY w ej/                    dvrN e j0        e          Z1de1v rn9	 d e1D             Zn+# e2$ r# de3                                 Z4 e5e4          w xY wdev rdZej6        7                    de8                                          Z9ej6        :                    ed !          Z;ej        d"             Z<ej=        >                    ej?        @                     ejA                    d#                     ejB        C                    d$dd%           ejB        C                    d&dddd eDejE                  '           ejF        G                    d(d&          ZHejB        I                    eH           ered7d)            ZJeJe_K         eLg d*          e_M        ej$        d+k     r%ejM        "                     eLg d,                     g d-e_N        d.d/d/d0d1d2d3e_O         eLd4g          e_P        d5d6gie_Q        dS dS )8    N)contextmanager)get_fpu_mode)FPUModeChangeWarning)SCIPY_ARRAY_APISCIPY_DEVICE)_pep440)	dt_configTFc                 j   |                      dd           |                      dd           |                      dd           	 dd l}n&# t          $ r |                      dd           Y nw xY w	 ddlm} n&# t          $ r |                      dd           Y nw xY w|                      dd	           d S )
Nmarkerszslow: Tests that are very slow.zHxslow: mark test as extremely slow (not run unless explicitly requested)z8xfail_on_32bit: mark test as failing on 32-bit platformsr   z.timeout: mark a test for a non-default timeout)parse_durationz8fail_slow: mark a test for a non-default timeout failurezskip_xp_backends(*backends, reasons=None, np_only=False, cpu_only=False): mark the desired skip configuration for the `skip_xp_backends` fixture.)addinivalue_linepytest_timeout	Exceptionpytest_fail_slowr   )configr   r   s      M/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/scipy/conftest.pypytest_configurer      sZ   
I)+ + +
IRT T T
IBD D DI I I IG	I 	I 	I 	I 	IIS 	4333333 S S SQ	S 	S 	S 	S 	SS I	RS S S S Ss$   A	 	 A,+A,0A7 7 BBc                    |                      d          }|W	 t          t          j                            dd                    }n# t
          $ r d}Y nw xY w|st          j        d           |                      d          }|?t          j	        d          j
        dk     r"t          j        d	|j        d                     t          j                    5 }|                    t          j                   	 dd
lm} d}n# t&          $ r d}Y nw xY w|r	 t          t          j        d                   }n# t(          $ r Y d d d            d S w xY wt          j        d          sTt          j                    dz  }t/          ||z  d          }	  ||d           n# t&          $ r Y d d d            d S w xY wd d d            d S # 1 swxY w Y   d S )NxslowSCIPY_XSLOW0Fz@very slow test; set environment variable SCIPY_XSLOW=1 to run itxfail_on_32bitr      z&Fails on our 32-bit test platform(s): )threadpool_limitsTPYTEST_XDIST_WORKER_COUNTOMP_NUM_THREADS      blas)user_api)get_closest_markerintosenvironget
ValueErrorpytestskipnpintpitemsizexfailargsnptsuppress_warningsfilter PytestUnraisableExceptionWarningthreadpoolctlr   r   KeyErrorgetenv	cpu_countmax)	itemmarkvsupr   HAS_THREADPOOLCTLxdist_worker_countmax_openmp_threadsthreads_per_workers	            r   pytest_runtest_setupr?   1   s   ""7++D	BJNN=#6677AA 	 	 	AAA	 	LK K L L L""#344DBGAJJ/!33LdilLLMMM 
		 	  C

6:;;;	&777777 $ 	& 	& 	& %	&  	
%(4O)P%Q%Q""   )       $ 9.// %'\^^q%8"%();?Q)QST%U%U"%%&86JJJJJ     =       67                 s   -A AA G9DGDGDGD76G7
EGEA GFG
F8)G7F88GGGfunction)scopeautousec              #      K   t                      }dV  t                      }||k    r't          j        d|dd|ddt          d           dS dS )z9
    Check FPU mode was not changed during the test.
    NzFPU mode changed from z#xz to z during the testr   )category
stacklevel)r   warningswarnr   )requestold_modenew_modes      r   check_fpu_moderK   b   s      
 ~~H	EEE~~H8 !xU ! !U ! ! !3	C 	C 	C 	C 	C 	C     numpyarray_api_strictz2.0z'array-api-strict must be >= version 2.0z2023.12)api_versionpytorchcupy	jax.numpyjax_enable_x64jax_default_device)1trueallc                 *    i | ]}|t           |         S  )xp_available_backends).0backends     r   
<dictcomp>r]      s0     ) ) ) 27;) ) )rL   z!'--array-api-backend' must be in cudaxpzsTest involves masked arrays, object arrays, or other types that are not valid input when `SCIPY_ARRAY_API` is used.reasonc                    d|j         vrdS |j         d         j        }|j         d         j        }|                    dd          }|                    dd          }|rA|                    ddg          }|d         }| j        d	k    rt          j        |
           dS |rd}t          rt          dk    r| j        dk    rt          j        |
           n| j        dk    r7d| 	                    d          j
        j        vrt          j        |
           nS| j        dk    rH| 	                    d                                          D ] }d|j        vrt          j        |
           !|[|                    dd          }t          |          D ]7\  }	}
| j        |
k    r%|sd|
 }n||	         }t          j        |
           6dS dS )a  
    Skip based on the ``skip_xp_backends`` marker.

    Parameters
    ----------
    *backends : tuple
        Backends to skip, e.g. ``("array_api_strict", "torch")``.
        These are overriden when ``np_only`` is ``True``, and are not
        necessary to provide for non-CPU backends when ``cpu_only`` is ``True``.
    reasons : list, optional
        A list of reasons for each skip. When ``np_only`` is ``True``,
        this should be a singleton list. Otherwise, this should be a list
        of reasons, one for each corresponding backend in ``backends``.
        If unprovided, default reasons are used. Note that it is not possible
        to specify a custom reason with ``cpu_only``. Default: ``None``.
    np_only : bool, optional
        When ``True``, the test is skipped for all backends other
        than the default NumPy backend. There is no need to provide
        any ``backends`` in this case. To specify a reason, pass a
        singleton list to ``reasons``. Default: ``False``.
    cpu_only : bool, optional
        When ``True``, the test is skipped on non-CPU devices.
        There is no need to provide any ``backends`` in this case,
        but any ``backends`` will also be skipped on the CPU.
        Default: ``False``.
    skip_xp_backendsNnp_onlyFcpu_onlyreasonsz#do not run with non-NumPy backends.r   rM   r`   z4do not run with `SCIPY_ARRAY_API` set and not on CPUcpurQ   torchrR   z#do not run with array API backend: )keywordsr-   kwargsr%   __name__r'   r(   r   r   emptydevicetypedevicesdevice_kind	enumerate)r_   rH   backendsrj   rd   re   rf   ra   dir\   s              r   rc   rc      s   8 !111 238H018FjjE**Gzz*e,,H **Y)N(OPP;'!!Kv&&&& 3G 		3|u44{f$$6*****'' 2 777Kv....++!,,.. 3 3AAM1162222**Y..#H-- 	+ 	+JAw{g%% (L7LLFF$QZF6**** 	+ 	+rL   z.hypothesisnondeterministic)namedeadline
print_blobdeterministic)rv   rw   rx   databasederandomizesuppress_health_checkSCIPY_HYPOTHESIS_PROFILEc              #     K   t                      }ddg}|D ]}t          t          d          ||<   g d}|D ]}t          t                    ||<   ddlm} d	d
g}|D ]}t          |j        d          ||<   g d}|D ]}t          t                    ||<   t          t          d          t          dt                    t          d|j                  d}|                    |           t          d          }	ddl
m}
 ddl} |
            5  |j                            d           t          j                    5  | r*| j        |v r!t          j        di || j                  dV  n.| r| j        |	v rdV  nt          j        dt(                     dV  ddd           n# 1 swxY w Y   ddd           dS # 1 swxY w Y   dS )zmTemporarily turn (almost) all warnings to errors.

        Filter out known warnings which we allow.
        zscipy.linalg.normzscipy.ndimage.center_of_masszdivide by zero)rD   message)zscipy.signal.cwtzscipy.signal.morletzscipy.signal.morlet2zscipy.signal.rickerzscipy.integrate.simpsonzscipy.interpolate.interp2d)rD   r   )	integratezscipy.special.ellip_normalzscipy.special.ellip_harm_2zThe occurrence of roundoff)zscipy.stats.anderson_ksampzscipy.stats.kurtosistestzscipy.stats.normaltestscipy.sparse.linalg.normzExited at iterationzthe matrix subclass is not)r   rD   z"The maximum number of subdivisions)r   z
linalg.rstz	stats.rstscipy.signal.normalize)_fixed_default_rngNignoreerror)r   )dictRuntimeWarningDeprecationWarningscipyr   IntegrationWarningUserWarningPendingDeprecationWarningupdatesetscipy._lib._utilr   rM   randomseedrF   catch_warningsrv   filterwarningssimplefilterWarning)testknown_warningsdivide_by_zerorv   
deprecatedr   integration_wuser_wdctlegitr   r)   s               r   warnings_errors_and_rngr     s7        !?
 # 	B 	BD#'0@$B $B $BN4  
 
 

  	E 	ED#'1C#D#D#DN4  ######55
 " 	N 	ND#'1M0L$N $N $NN4  H H H 	> 	>D#'#=#=#=N4  
 k3HIII 979 9 9 A':< < <

 

 	c""" ,-- 	877777!! 	 	INN4   (** 	 	 DI77+ I I.<TY.GI I IEEEE di500EEEE)'7;;;EEE	 	 	 	 	 	 	 	 	 	 	 	 	 	 		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s7   .GAF, G,F0	0G3F0	4GGG)zscipy.linalg.LinAlgErrorzscipy.fftpack.fftshiftzscipy.fftpack.ifftshiftzscipy.fftpack.fftfreqzscipy.special.sinczscipy.optimize.show_optionsr   r   2)zscipy.io.hb_readzscipy.io.hb_writez)scipy.sparse.csgraph.connected_componentsz&scipy.sparse.csgraph.depth_first_orderz"scipy.sparse.csgraph.shortest_pathz#scipy.sparse.csgraph.floyd_warshallzscipy.sparse.csgraph.dijkstraz!scipy.sparse.csgraph.bellman_fordzscipy.sparse.csgraph.johnsonzscipy.sparse.csgraph.yenz(scipy.sparse.csgraph.breadth_first_orderz*scipy.sparse.csgraph.reverse_cuthill_mckeez$scipy.sparse.csgraph.structural_rankz*scipy.sparse.csgraph.construct_dist_matrixz%scipy.sparse.csgraph.reconstruct_pathzscipy.ndimage.value_indiceszscipy.stats.mstats.describe)zscipy.stats.distributionszscipy.optimize.cython_optimizez
scipy.testzscipy.show_config zReST parser limitationz__cinit__ unexpected argumentznan in scalar_powerzintegration warning)io.rstzND_regular_grid.rstzextrapolation_examples.rstzsampling_pinv.rstzsampling_srou.rstzprobability_distributions.rstzintegrate.nquad(func,r   zoctave_a.mat)N)Rjsonr#   rF   tempfile
contextlibr   rM   r)   numpy.testingtestingr.   r'   
hypothesisscipy._lib._fpumoder   scipy._lib._testutilsr   scipy._lib._array_apir   r   
scipy._libr   scipy_doctest.conftestr	   
HAVE_SCPDTModuleNotFoundErrorr   r?   fixturerK   rZ   
isinstancestrrN   r   parse__version__VersionImportErrorset_array_api_strict_flagsrh   set_default_devicerQ   	jax.numpyjaxr   ro   lowerloadsSCIPY_ARRAY_API_r3   keysmsgr&   r8   parametrizevaluesarray_api_compatibleskipifskip_xp_invalid_argrc   configurationset_hypothesis_home_dirpathjoin
gettempdirsettingsregister_profilelistHealthCheckr$   r%   r}   load_profiler   user_context_mgrr   skiplistpytest_extra_ignorepytest_extra_xfail
pseudocodelocal_resourcesrY   rL   r   <module>r      sk    				   % % % % % %                , , , , , , 6 6 6 6 6 6 ? ? ? ? ? ? ? ?      000000JJ   JJJS S S0. . .b j$///C C 0/C !"  2&zz/377 2&	$$&8:J%KLLL7=)5669O9OOO+GHHH33!	
 	
 	
 	
 	
    $$i%7888  ....   $$fd^4444   $$k39%=>>>
*D111
.L0I0I!0LMMMM    m33%4:o66$$$&) )#3) ) )%%  & & &X:O:T:T:V:VXX joo%& 
"""L{..t5J5Q5Q5S5STT k((I ) K K 
 <+ <+ <+D   0 0GLL$$&&66     $ $	dt %      $ $	dTt$z566 %    :>>*D*9; ;  
     !9 : : :  L= N N N ^Nb "9I 	 	 	 	 	I 
~!!## ' ' ' # # 	 	 	,% % %I! 7&><2)>$ $I  3 7899I!)N+; <IYL= L=sh   A AAAC/ /C76C7;+D' 'D/.D/3E EEA*G GG8H (H-