
    ^MhV              
       B   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 dlZdZn# e$ r d	ZY nw xY wd
 Zd Z ej        dd          d             Z esej        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/Z0e"&                    de0j        i           e0j1        &                    dd           e0j1        &                    d e0j2        e          d                     n# e*$ r Y nw xY w ej3                    dvrN e j4        e          Z5de5v rn9	 d e5D             Z"n+# e6$ r# de"7                                 Z8 e9e8          w xY wde"v rdZej:        ;                    d e"<                                          Z=ej:        >                    ed!"          Z?d# Z@ej        d$             ZAej        d%             ZBd;d'ZCejD        E                    ejF        G                     ejH                    d(                     ejI        J                    d)dd*           ejI        J                    d+dddd eKejL                  ,           ejM        N                    d-d+          ZOejI        P                    eO           ered<d.            ZQeQe_R         eSg d/          e_T        ej(        d0k     r%ejT        &                     eSg d1                     g d2e_U        d3d3d4d5d6d7e_V         eSd8g          e_W        d9g d:ie_X        de_Y        dS dS )=    N)contextmanager)get_fpu_mode)FPUModeChangeWarning)SCIPY_ARRAY_APISCIPY_DEVICE)_pep440)	dt_configTFc                 ,   |                      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d
           t
          sD|                      dd           |                      dd           |                      dd           d S 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, reason=None, np_only=False, cpu_only=False, exceptions=None): mark the desired skip configuration for the `skip_xp_backends` fixture.zxfail_xp_backends(backends, reason=None, np_only=False, cpu_only=False, exceptions=None): mark the desired xfail configuration for the `xfail_xp_backends` fixture.zOparallel_threads(n): run the given test function in parallel using `n` threads.z8thread_unsafe: mark the test function as single-threadedzCiterations(n): run the given test function `n` times in each thread)addinivalue_linepytest_timeout	Exceptionpytest_fail_slowr   PARALLEL_RUN_AVAILABLE)configr   r   s      N/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/scipy/conftest.pypytest_configurer      s   
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 I	TU U U " 
!	" 	" 	" 	F	
 	
 	
 	Q	
 	
 	
 	
 	

 
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@   I   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_moderL   z   s      
 ~~H	EEE~~H8 !xU ! !U ! ! !3	C 	C 	C 	C 	C 	C     c                      dS )Nr    rO   rM   r   num_parallel_threadsrP      s    qrM   numpyarray_api_strictz2.0z'array-api-strict must be >= version 2.0z2023.12)api_versiontorchcupy	jax.numpyjax_enable_x64jax_default_device)1trueallc                 *    i | ]}|t           |         S rO   )xp_available_backends).0backends     r   
<dictcomp>r`      s0     ) ) ) 27;) ) )rM   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                    | j         | d         j        }t          |          dk    rt          d|           t	          | j                            | d                    }g }i }|D ]}|j                            d          r$d|d<   |j                            dg           |d<   nR|j                            d          r8|                    d          s#d|d<   |j                            dg           |d<   t          |j                  dk    r6|j        d         }|	                    |            |j
        d	i ||j        i ||fS )
z%A helper for {skip,xfail}_xp_backends_xp_backendsr   zmultiple backends: np_onlyT
exceptionscpu_onlyr   rO   )keywordsr.   lenr'   listnodeiter_markerskwargsr&   appendupdate)rI   skip_or_xfailargs_r   backendsro   markerr_   s           r   _backends_kwargs_from_requestrv      sy    ;;;<AE
5zzA~~ 6u667777<,,-K-K-KLLMMGHF 6 6=Y'' 	K $F9#)=#4#4\2#F#FF<  ]z** 	K::i(( K%)z"'-}'8'8r'J'J|$ v{ak!nGOOG$$$FM55Wfm4555VrM   c                 j    d|j         vrdS t          |d          \  }}t          | ||d           dS )a  skip_xp_backends(backend=None, reason=None, np_only=False, cpu_only=False, exceptions=None)

    Skip a decorated test for the provided backend, or skip a category of backends.

    See ``skip_or_xfail_backends`` docstring for details. Note that, contrary to
    ``skip_or_xfail_backends``, the ``backend`` and ``reason`` arguments are optional
    single strings: this function only skips a single backend at a time.
    To skip multiple backends, provide multiple decorators.
    skip_xp_backendsNr)   rr   rj   rv   skip_or_xfail_xp_backendsrb   rI   rt   ro   s       r   rx   rx      sK     !1114WFSSSHfb(F&IIIIIIrM   c                 j    d|j         vrdS t          |d          \  }}t          | ||d           dS )a  xfail_xp_backends(backend=None, reason=None, np_only=False, cpu_only=False, exceptions=None)

    xfail a decorated test for the provided backend, or xfail a category of backends.

    See ``skip_or_xfail_backends`` docstring for details. Note that, contrary to
    ``skip_or_xfail_backends``, the ``backend`` and ``reason`` arguments are optional
    single strings: this function only xfails a single backend at a time.
    To xfail multiple backends, provide multiple decorators.
    xfail_xp_backendsNr-   ry   rz   r|   s       r   r~   r~     sK     '"2224WGTTTHfb(F'JJJJJJrM   r)   c                 J   t          t          |          }|                    dd          }|                    dd          }|                    dg           }|                    d          x}rt          d|d          |r|rd}|r|s|st          d          |ro|                    d	d
          }t	          |t
                    s"t          |          dk    rt          d          | j        dk    r| j        |vr ||           dS |rd}|g n|}t          rt          dk    r| j        dk    rd|vr ||           n| j        dk    r2d|vr.d| 
                    d          j        j        vr ||           nN| j        dk    rCd|vr?| 
                    d                                          D ]}	d|	j        vr ||           |Nt          |          D ]@\  }
}| j        |k    r.||                             d	          }|sd| } ||           ?dS dS )an  
    Skip based on the ``skip_xp_backends`` or ``xfail_xp_backends`` marker.

    See the "Support for the array API standard" docs page for usage examples.

    Parameters
    ----------
    backends : tuple
        Backends to skip/xfail, 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``.
        For a custom reason to apply, you should pass a dict ``{'reason': '...'}``
        to a keyword matching the name of the backend.
    reason : str, optional
        A reason for the skip/xfail in the case of ``np_only=True``.
        If unprovided, a default reason is used. Note that it is not possible
        to specify a custom reason with ``cpu_only``.
    np_only : bool, optional
        When ``True``, the test is skipped/xfailed 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
        value to ``reason``. Default: ``False``.
    cpu_only : bool, optional
        When ``True``, the test is skipped/xfailed 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``.
    exceptions : list, optional
        A list of exceptions for use with ``cpu_only`` or ``np_only``.
        This should be provided when delegation is implemented for some,
        but not all, non-CPU/non-NumPy backends.
    skip_or_xfail : str
        ``'skip'`` to skip, ``'xfail'`` to xfail.
    rg   Fri   rh   reasonsz.provide a single `reason=` kwarg; got reasons=z insteadz<`exceptions` is only valid alongside `cpu_only` or `np_only`rd   z#do not run with non-NumPy backends.r   z8please provide a singleton `reason` when using `np_only`rQ   rc   NzTno array-agnostic implementation or delegation available for this backend and devicecpurU   rT   r   rV   z#do not run with array API backend: )getattrr(   r&   r'   
isinstancestrrk   __name__r   r   emptydevicetypedevicesdevice_kind	enumerate)rb   rt   ro   rr   rg   ri   rh   r   rd   dir_   s               r   r{   r{     s   F FM22MjjE**Gzz*e,,HL"--J**Y'''w VT'TTTUUU  8  Y8 Yw YWXXX H&KLL&#&& 	53v;;?? 4 5 5 5;'!!bk&C&CM(((( 50%-RR:
 		5|u44{f$$z)A)AV,,,,,''G:,E,E 2 777!M0000++:0M0M!,,.. 5 5AAM11%V4444#H-- 	- 	-JAw{g%%,,X66 ML7LLFV,,,, 	- 	-rM   z.hypothesisnondeterministic)namedeadline
print_blobdeterministic)r   r   r   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)rE   message)zscipy.signal.cwtzscipy.signal.morletzscipy.signal.morlet2zscipy.signal.rickerzscipy.integrate.simpsonzscipy.interpolate.interp2dzscipy.linalg.kron)rE   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   rE   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PendingDeprecationWarningrq   setscipy._lib._utilr   rQ   randomseedrG   catch_warningsr   filterwarningssimplefilterWarning)testknown_warningsdivide_by_zeror   
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   z$scipy.io.matlab.MatlabObject.stridesz"scipy.io.matlab.MatlabObject.dtypez"scipy.io.matlab.MatlabOpaque.dtypez$scipy.io.matlab.MatlabOpaque.stridesz&scipy.io.matlab.MatlabFunction.stridesz$scipy.io.matlab.MatlabFunction.dtype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_configzscipy/special/_precomputez#scipy/interpolate/_interpnd_info.pyzscipy/_lib/array_api_compatzscipy/_lib/highszscipy/_lib/unuranzscipy/_lib/_gcutils.pyzscipy/_lib/doccer.pyzscipy/_lib/_uarrayzReST parser limitationz__cinit__ unexpected argumentznan in scalar_powerzintegration warning)zND_regular_grid.rstzextrapolation_examples.rstzsampling_pinv.rstzsampling_srou.rstzprobability_distributions.rstzintegrate.nquad(func,zio.rst)zoctave_a.matzoctave_cells.matzoctave_struct.mat)r)   )N)Zjsonr$   rG   tempfile
contextlibr   rQ   r*   numpy.testingtestingr/   r(   
hypothesisscipy._lib._fpumoder   scipy._lib._testutilsr   scipy._lib._array_apir   r   
scipy._libr   scipy_doctest.conftestr	   
HAVE_SCPDTModuleNotFoundErrorpytest_run_parallelr   r   r   r@   fixturerL   rP   r]   r   r   rR   rq   parse__version__VersionImportErrorset_array_api_strict_flagsrT   set_default_devicerU   	jax.numpyjaxr   r   lowerloadsSCIPY_ARRAY_API_r4   keysmsgr'   r9   parametrizevaluesarray_api_compatibleskipifskip_xp_invalid_argrv   rx   r~   r{   configurationset_hypothesis_home_dirpathjoin
gettempdirsettingsregister_profilerl   HealthCheckr%   r&   r   load_profiler   user_context_mgrr   skiplistpytest_extra_ignorepytest_extra_xfail
pseudocodelocal_resourcesstrict_checkrO   rM   r   <module>r      s,    				   % % % % % %                , , , , , , 6 6 6 6 6 6 ? ? ? ? ? ? ? ?      000000JJ   JJJ#! # # #"#'
 '
 '
T. . .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!	
 	
 	
 	
 	
    $$gu%5666  ....   $$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 
  > J J J" K K K P- P- P- P-l   0 0GLL$$&&66     $ $	dt %      $ $	dTt$z566 %    :>>*D*9; ;  
     !9 : : :  d" O O O ^Ob "9I     I( 
~!!## ' ' ' # # 	 	 	,% % %I!$  8&><2)>$ $I  3 7899I 
 
 
!I "IId" d"sz   A AAA" "A,+A,7AD DD"+E EEE6 6E>=E>A*G- -G54G5H, ,(I