
    \cip              
       6   d dl Z d dlZd dlZd dl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ZdZn# e$ r dZY nw xY wd dlmZ d dlmZmZmZmZmZmZmZmZ d dlmZ d d	l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,h dZ- ej.        edej/        j0                  gZ1 e2            Z3 e2            Z4erG	 d dl5Z5e16                     ej.        e5dej/        j0                              e j7        e5j8                   e j9        d          k     r ed           e5j:        d           n# e$ r Y nw xY w	 d dl;Z;e16                     ej.        e;dej/        j0                              e;j<        e           edk    re3=                    d            ej>        dd          Z?e?dk    r e;j@        e;jA                   ne?dk    r eBd e? d!          n# e$ r Y nw xY w	 d dlCZCe16                     ej.        eCd"ej/        j0                             e3=                    d"            ejD        d#d$eE%           d d&lFmGZG [Gn# e$ r Y nw xY w	 d dlHZIe16                     ej.        eIj
        d'ej/        j0        ej/        jJ        g                     eIjK        L                    d(d           eIjK        L                    d) eIjM        e          d                     edk    re3=                    d'           e4=                    d'           n# e$ r Y nw xY w	 d dlNmOZP e16                     ej.        ePd*ej/        j0        ej/        jJ        g                     e4=                    d*           n# e$ r Y nw xY wd+ e1D             ZQeQe-z
  rJ  eReeS          rU ejT                    d,vrD e2 e jU        e                    ZVeVd-hk    r$eVeQz
  rd.eQ d/eV ZW eBeW          d0 e1D             Z1 ej*        e11          d2             ZXej/        Y                    ed34          ZZd5 Z[d6ej\        d7e	d8         d9dfd:Z]ej*        d;             ZMerej^        _                    ej`        a                     ejb                    d<                     ejc        d                    d=dd>           ejc        d                    d?dddd eeejf                  @           ejg        h                    dAd?          Ziejc        j                    ei           e#redPdB            Zkeke"_l         e2g dC          e"_m        ej8        dDk     r%e"jm        L                     e2g dE                     g dFe"_n        dGdGdHdIdJdKe"_o         e2dLg          e"_p        dMg dNie"_q        de"_r        e"js        =                    dO           dS dS )Q    N)contextmanager)LiteralTF)get_fpu_mode)SCIPY_ARRAY_APISCIPY_DEVICEarray_namespace
default_xpis_cupyis_daskis_jaxis_torch)FPUModeChangeWarning)patch_lazy_xp_functions)_pep440)	dt_configc                    |                      dd           |                      dd           |                      dd           |                      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t
          sB|                      dd           |                      dd           |                      dd           t          j        dk    r(t          j	        dk     rt          j        dd           d	S d	S d	S )a  
    Add pytest markers to avoid PytestUnknownMarkWarning

    This needs to contain all markers that are SciPy-specific, as well as
    dummy fallbacks for markers defined in optional test packages.

    Note that we need both the registration here *and* in `pytest.ini`.
    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 platformsz;array_api_backends: test iterates on all array API backendszskip_xp_backends(backends, reason=None, np_only=False, cpu_only=False, eager_only=False, exceptions=None): mark the desired skip configuration for the `skip_xp_backends` fixturezxfail_xp_backends(backends, reason=None, np_only=False, cpu_only=False, eager_only=False, exceptions=None): mark the desired xfail configuration for the `xfail_xp_backends` fixturer   Nz.timeout: mark a test for a non-default timeout)parse_durationz8fail_slow: mark a test for a non-default timeout failurezUparallel_threads_limit(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posix)      
forkserverT)force)addinivalue_linepytest_timeout	Exceptionpytest_fail_slowr   PARALLEL_RUN_AVAILABLEosnamesysversion_infomultiprocessingset_start_method)configr   r   s      ^/var/www/html/mdtn/previsions/meteo_cartes/venv/lib/python3.11/site-packages/scipy/conftest.pypytest_configurer'   )   s=    I)+ + +
IRT T T
IBD D D
IEG G G
I
.0 0 0 I
/1 1 1
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 " 
!	" 	" 	" 	F	
 	
 	
 	Q	
 	
 	

 
w'c.88 	(TBBBBBB	 88s$   B  B.-B.2B9 9 CC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
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): ignore)threadpool_limitsTPYTEST_XDIST_WORKER_COUNTOMP_NUM_THREADS      blas)user_api)get_closest_markerintr   environget
ValueErrorpytestskipnpintpitemsizexfailargswarningscatch_warningssimplefilter PytestUnraisableExceptionWarningthreadpoolctlr/   r   KeyErrorgetenv	cpu_countmax)itemmarkvr/   HAS_THREADPOOLCTLxdist_worker_countmax_openmp_threadsthreads_per_workers           r&   pytest_runtest_setuprR   e   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 
	 	"	"  h(OPPP	&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   rB   warnr   )requestold_modenew_modes      r&   check_fpu_moder]      s      
 ~~H	EEE~~H8 !xU ! !U ! ! !3	C 	C 	C 	C 	C 	C     c                      dS )Nr3    r`   r^   r&   num_parallel_threadsra      s    qr^   >   cupynumpytorcharray_api_strict	jax.numpy
dask.arrayrc   )idmarksre   z2.3z'array-api-strict must be >= version 2.3z2024.12)api_versionrd   cpuSCIPY_DEFAULT_DTYPEfloat64)defaultfloat32zUSCIPY_DEFAULT_DTYPE env var, if set, can only be either 'float64' or 'float32'. Got 'z
' instead.rb   r.   z#cupyx.jit.rawkernel is experimentalrW   )signalrf   jax_enable_x64jax_default_devicerg   c                     h | ]	}|j         
S r`   )rh   ).0ps     r&   	<setcomp>rw     s    DDDDDDr^   )1trueallrz   z!'--array-api-backend' must be in z; got c                 .    g | ]}|j         t          v |S r`   )rh   SCIPY_ARRAY_API_)ru   params     r&   
<listcomp>r~      s0     % % %8/// ///r^   )paramsc              #   j  K   t          | d           t          | d           | j        }t          |                    d                    }t          r\t          | | j                  5  t          |          5  |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 |V  dS )a  Run the test that uses this fixture on each available array API library.

    You can select all and only the tests that use the `xp` fixture by
    passing `-m array_api_backends` to pytest.

    You can select where individual tests run through the `@skip_xp_backends`,
    `@xfail_xp_backends`, and `@skip_xp_invalid_arg` pytest markers.

    Please read: https://docs.scipy.org/doc/scipy/dev/api-dev/array_api.html#adding-tests
    r<   r@   r   rZ   xpN)skip_or_xfail_xp_backendsr}   r   emptyr   r   r	   r   s     r&   r   r   &  sF      gv... gw///	B	!	%	%B  %WGGG 	 	
 B                	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 s6   )B"9B
>B"
B	B"B	B""B&)B&zsTest involves masked arrays, object arrays, or other types that are not valid input when `SCIPY_ARRAY_API` is used.reasonc           	      &   t          | j                            | d                    }d t          D             }|D ]}t	          |j                  h dz
  }|rt          d|           t	          |j                            dg                     }|t          z
  }t          |t          z
            x}r't          d| dt          t                               |j                            dd	          rV|j                            d
          pd}|	                                D ]$\  }	}
|	dk    r|	|vr|

                    |           %n|j                            dd	          rE|j                            d
          pd}t          |z
  D ]}	||	         
                    |           n_|j                            dd	          rD|j                            d
          pd}t          |z
  D ]}	||	         
                    |           t          |j                  dk    r|j        d         }	|	t          vr't          d|	 dt          t                               |j                            d
          pd|	 }||	                             d|           dD ]}||j        v rt          | d|	            t          |j                  dk    rt          d|j                   d |	                                D             S )ztA helper for {skip,xfail}_xp_backends.

    Return dict of {backend to skip/xfail: top reason to skip/xfail it}
    _xp_backendsc                     i | ]}|g S r`   r`   )ru   backends     r&   
<dictcomp>z1_backends_kwargs_from_request.<locals>.<dictcomp>V  s    <<<ww<<<r^   >   r   np_onlycpu_only
eager_only
exceptionszInvalid kwargs: r   zUnknown backend(s): z; must be a subset of r   Fr   z"do not run with non-NumPy backendsrc   r   zTno array-agnostic implementation or delegation available for this backend and devicer   z*eager checks not executed on lazy backendsr3   r   zUnknown backend: z; must be one of z#do not run with array API backend: )r   r   r   r   z is mutually exclusive with z,Please specify only one backend per marker: c                 *    i | ]\  }}|||d          S )r   r`   )ru   r   backend_reasonss      r&   r   z1_backends_kwargs_from_request.<locals>.<dictcomp>  s8          ( G_Q'      r^   )listnodeiter_markersxp_known_backendssetkwargs	TypeErrorr9   r:   itemsappendxp_skip_cpu_only_backendsxp_skip_eager_only_backendslenrA   insert)rZ   skip_or_xfailr   reasonsmarkerinvalid_kwargsr   invalid_exceptionsr   r   r   kwargs               r&   _backends_kwargs_from_requestr   P  s   
 7<,,-K-K-KLLMMG<<*;<<<G 2 2V]++ /I /I /I I 	A?~??@@@**<<<==
'*;;"&z4E'E"F"FF 	O N4F N N489J4K4KN N O O O =Y.. 	0]&&x00X4XF,3MMOO 3 3(g%%'*C*C#**62223 ]z511 	0]&&x00 /.  5zA 0 0 ''////0 ]|U33 	0]&&x00 >< 6C 0 0 ''//// v{q  k!nG///  "MW "M "M378I3J3J"M "M N N N]&&x00 A?g??  G##Av...L V VFM))$%T%T7%T%TUUU *V !!Lv{LL   "
   ,3MMOO       r^   rZ   r   )r<   r@   returnc                     | d| j         vrdS t          | |          }| j        }|j        |v r4||j                 }|sJ t	          t
          |          } ||           dS dS )aP  
    Helper of the `xp` fixture.
    Skip or xfail based on the ``skip_xp_backends`` or ``xfail_xp_backends`` markers.

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

    Usage
    -----
    ::
        skip_xp_backends = pytest.mark.skip_xp_backends
        xfail_xp_backends = pytest.mark.xfail_xp_backends
        ...

        @skip_xp_backends(backend, *, reason=None)
        @skip_xp_backends(*, cpu_only=True, exceptions=(), reason=None)
        @skip_xp_backends(*, eager_only=True, exceptions=(), reason=None)
        @skip_xp_backends(*, np_only=True, exceptions=(), reason=None)

        @xfail_xp_backends(backend, *, reason=None)
        @xfail_xp_backends(*, cpu_only=True, exceptions=(), reason=None)
        @xfail_xp_backends(*, eager_only=True, exceptions=(), reason=None)
        @xfail_xp_backends(*, np_only=True, exceptions=(), reason=None)

    Parameters
    ----------
    backend : str, optional
        Backend to skip/xfail, e.g. ``"torch"``.
        Mutually exclusive with ``cpu_only``, ``eager_only``, and ``np_only``.
    cpu_only : bool, optional
        When ``True``, the test is skipped/xfailed on non-CPU devices,
        minus exceptions. Mutually exclusive with ``backend``.
    eager_only : bool, optional
        When ``True``, the test is skipped/xfailed for lazy backends, e.g. those
        with major caveats when invoking ``__array__``, ``__bool__``, ``__float__``,
        or ``__complex__``, minus exceptions. Mutually exclusive with ``backend``.
    np_only : bool, optional
        When ``True``, the test is skipped/xfailed for all backends other
        than the default NumPy backend and the exceptions.
        Mutually exclusive with ``backend``. Implies ``cpu_only`` and ``eager_only``.
    reason : str, optional
        A reason for the skip/xfail. If omitted, a default reason is used.
    exceptions : list[str], optional
        A list of exceptions for use with ``cpu_only``, ``eager_only``, or ``np_only``.
        This should be provided when delegation is implemented for some,
        but not all, non-CPU/non-NumPy backends.
    r   N)r   r   )keywordsr   r}   __name__getattrr;   )rZ   r   skip_xfail_reasonsr   r   s        r&   r   r     s    ` %%%W-===6}   
B	{(((#BK066V$$$$$$	 )(r^   c                    t          |           rt          j        d           t          |           rddgS t	          |           rt          j        d           t          |           r2|                                                                 }d |D             S |                                                                 dgz   S )ao  Fixture that returns a list of all devices for the backend, plus None.
    Used to test input->output device propagation.

    Usage
    -----
    from scipy._lib._array_api import xp_device

    def test_device(xp, devices):
        for d in devices:
            x = xp.asarray(..., device=d)
            y = f(x)
            assert xp_device(y) == xp_device(x)
    zdata-apis/array-api-compat#293r   rk   Nzjax-ml/jax#26000c              3   0   K   | ]}|j         d k    |V  dS )metaN)type)ru   devices     r&   	<genexpr>zdevices.<locals>.<genexpr>  s.      FF6v0E0E0E0E0E0EFFr^   )r
   r;   r@   r   r   r   __array_namespace_info__devices)r   r   s     r&   r   r     s     r{{ > 	<====r{{ t}bzz 0 	.////|| G--//7799FFWFFFF&&((0022dV;;r^   z.hypothesisnondeterministic)r    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 ]}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  nI| r| j        |	v rdV  n9t          j        dt(                     t          j        d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)rW   messagerp   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   rW   z"The maximum number of subdivisions)r   z
linalg.rstz	stats.rstscipy.signal.normalize)_fixed_default_rngNr.   errorz.*odr.*)r.   )dictRuntimeWarningDeprecationWarningscipyr   IntegrationWarningUserWarningPendingDeprecationWarningupdater   scipy._lib._utilr   rc   randomseedrB   rC   r    filterwarningsrD   Warning)testknown_warningsdivide_by_zeror    
deprecatedr   integration_wuser_wdctlegitr   r=   s               r&   warnings_errors_and_rngr     s1        !?
 # 	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+RRty8QRRREEEE di500EEEE)'7;;;+HiASTTTEEE	 	 	 	 	 	 	 	 	 	 	 	 	 	 		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s7   .GA6G9GG			GG		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/interpolate/_rbfinterp_pythran.pyzscipy/_build_utils/tempita.pyzscipy/_lib/array_api_compatzscipy/_lib/highszscipy/_lib/unuranzscipy/_lib/_gcutils.pyzscipy/_lib/doccer.pyzscipy/_lib/_uarrayz+scipy/linalg/_cython_signature_generator.pyzscipy/linalg/_generate_pyx.pyzscipy/linalg/_linalg_pythran.pyz$scipy/linalg/_matfuncs_sqrtm_triu.pyz1scipy/ndimage/utils/generate_label_testvectors.pyz scipy/optimize/_group_columns.pyz$scipy/optimize/_max_len_seq_inner.pyz"scipy/signal/_max_len_seq_inner.pyz%scipy/sparse/_generate_sparsetools.pyzscipy/special/_generate_pyx.pyzscipy/stats/_stats_pythran.pyz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.matz.text()N)tjsonr#   r   r!   rB   tempfile
contextlibr   typingr   rc   r=   r;   
hypothesishypothesis_availableImportErrorscipy._lib._fpumoder   scipy._lib._array_apir   r   r   r	   r
   r   r   r   scipy._lib._testutilsr   "scipy._lib.array_api_extra.testingr   
scipy._libr   scipy_doctest.conftestr   
HAVE_SCPDTModuleNotFoundErrorpytest_run_parallelr   r   r'   rR   fixturer]   ra   r   r}   rL   array_api_backendsxp_available_backendsr   r   r   re   r   parse__version__Versionset_array_api_strict_flagsrd   set_default_deviceaddrH   rn   set_default_dtyperm   r:   rb   r   FutureWarningcupyx.scipyrq   	jax.numpyjaxthread_unsafer%   r   r   
dask.arrayarraydaxp_available_backend_ids
isinstancestrlowerloadsr|   msgr   skipifskip_xp_invalid_argr   FixtureRequestr   configurationset_hypothesis_home_dirpathjoin
gettempdirsettingsregister_profiler   HealthCheckr8   r9   r   load_profiler   user_context_mgrskiplistpytest_extra_ignorepytest_extra_xfail
pseudocodelocal_resourcesstrict_check	stopwordsr`   r^   r&   <module>r     s
        				 



   % % % % % %           ! ! ! ! ! - , , , , ,                    7 6 6 6 6 6 F F F F F F      000000JJ   JJJ#! # # #"#9C 9C 9Cx. . .b j$///C C 0/C  ^  ^
# # #  FLv{'EFFF   CEE !cee  o$$FL).@%{=? ? ?	@ 	@ 	@ 7=)5669O9OOO+GHHH33!	
 	
 	
 	
 	
    $$FL7+02 2 2	3 	3 	3 	! ...5  %))'222 ")19EEEi#E#EM2222	!!*9%,9 9 9       	$$FL&+02 2 2	3 	3 	3 	"%%f--- 	 ;m	
 	
 	
 	
 	'&&&&&F   $$FL{;1;,./ / /	0 	0 	0 	
*D111
.L0I0I!0LMMM5  %))+666 	$''4444   $$FL;1;,./ / /	0 	0 	0 	$''5555     ED.CDDD'*;;;;; 	
?C((!O!##+???3ztz/::;;w&&":: &M2M M:JM M joo%% %#8% % %! ,---! ! .-!H k((I ) K K 
>  >  > B;%v'< ;%-4_-E;%JN;% ;% ;% ;%| #< #< #<L  ? 44
(X(**M::   (($4 )    (($4"d:#9:: )     "z~~.H.= ?  ?$$%=>>>  n& I I I ^IV "9I     I( 
~!!## ' ' ' # # 	 	 	,% % %I!>  8&><2)>$ $I  3 7899I 
 
 
!I "I H%%%%%]n& n&s   5 ??/A8 8BBB BBA7E? ?FFB"H. .H65H6:A#J J&%J&*B?M* *M21M26AO OO