
    \ciw                        U d 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
ZddlmZ ddlmZ ddlmc mc m
Z ddlmZmZ ddlmZ eZe	ed	<   eej        z  Ze	ed
<   ej                            dd          Zeez  ed<   ej                            dd          Z  G d dej!                  Z" ed          de#de"fd            Z$dedefdZ%dS )z|
Override functions from array_api_compat, for use by array-api-extra
and internally.

See also _array_api_compat_vendor.py
    N)	lru_cache)
ModuleType)Any	TypeAlias)array_api_compat)is_array_api_objis_jax_array)	SparseABCArray	ArrayLikeSCIPY_ARRAY_APIFSCIPY_DEVICEcpuc                       e Zd ZdZdZdZdZdS )_ArrayClsInfor            N)__name__
__module____qualname__skipnumpy
array_likeunknown     n/var/www/html/mdtn/previsions/meteo_cartes/venv/lib/python3.11/site-packages/scipy/_lib/_array_api_override.pyr   r       s"        DEJGGGr   r   d   clsreturnc           
      L   t          | t          t          f          rt          j        S t          | t
                    rd}t          |          t          | t          j        j	                  rt          d          t          | t          j                  rt          d          t          | t          j        t          j        f          rt          j        S t          | t          t           t"          t$          t'          d           f          rt          j        S t          j        S )NzSparse arrays/matrices are not supported by this function. Perhaps one of the `scipy.sparse.linalg` functions would work instead.z8Inputs of type `numpy.ma.MaskedArray` are not supported.z0Inputs of type `numpy.matrix` are not supported.)
issubclasslisttupler   r   r
   
ValueErrornpmaMaskedArray	TypeErrormatrixndarraygenericr   intfloatcomplexbooltyper   r   )r    msgs     r   _validate_array_clsr4   '   s    #u~&& ('' #y!! & oo#ru()) TRSSS#ry!! LJKKK#
BJ/00 #""
 #UGT4::>?? "!!  r   arraysc                     t           st          S g }g }| D ]N}t          t          |                    }|t          j        u r.|t          j        u rq|j        j        dv r|	                    |           `|j        j        dk    r%t          |          r|	                    |           t          d|j        d          |t          j        u r%t          |          r|	                    |           	 t          j        |          }n# t          $ r t          d          w xY w|j        j        dvrt          d|j        d          |	                    |           P|st          S t!          j        g ||R  S )al  Get the array API compatible namespace for the arrays xs.

    Parameters
    ----------
    *arrays : sequence of array_like
        Arrays used to infer the common namespace.

    Returns
    -------
    namespace : module
        Common namespace.

    Notes
    -----
    Wrapper around `array_api_compat.array_namespace`.

    1. Check for the global switch `SCIPY_ARRAY_API`. If disabled, just
       return array_api_compat.numpy namespace and skip all compliance checks.

    2. Check for known-bad array classes.
       The following subclasses are not supported and raise and error:

       - `numpy.ma.MaskedArray`
       - `numpy.matrix`
       - NumPy arrays which do not have a boolean or numerical dtype
       - `scipy.sparse` arrays

    3. Coerce array-likes to NumPy arrays and check their dtype.
       Note that non-scalar array-likes can't be mixed with non-NumPy Array
       API objects; e.g.

       - `array_namespace([1, 2])` returns NumPy namespace;
       - `array_namespace(np.asarray([1, 2], [3, 4])` returns NumPy namespace;
       - `array_namespace(cp.asarray([1, 2], [3, 4])` raises an error.
    iufcbVzAn argument has dtype `z3`; only boolean and numerical dtypes are supported.zCAn argument is neither array API compatible nor coercible by NumPy.)r   	np_compatr4   r2   r   r   r   dtypekindappendr	   r*   r   r   r'   
asanyarrayr   array_namespace)r5   numpy_arrays
api_arraysarrayarr_infos        r   r>   r>   E   s   H  LJ ' '&tE{{33}))),,,{7**##E****!S((\%-@-@( !!%(((( !S%+ !S !S !S T T T ...3CE3J3J.e$$$$7e,, 7 7 7 !6 7 7 77 {w.. !S%+ !S !S !S T T T&&&&   +G\GJGGGGs   6DD%)&__doc__enumos	functoolsr   typesr   typingr   r   r   r'   numpy.typingnpt
scipy._libr   !scipy._lib.array_api_compat.numpy_libr9   scipy._lib.array_api_compatr   r	   scipy._lib._sparser
   r   __annotations__r   environgetr   strr1   r   Enumr   r2   r4   r>   r   r   r   <module>rU      s      				             ! ! ! ! ! ! ! !           ' ' ' ' ' ' 5 5 5 5 5 5 5 5 5 5 5 5 F F F F F F F F ( ( ( ( ( ( y   s},	9 , , , !jnn->FFt F F Fz~~ne44    DI    3!T !m ! ! ! !:QHU QHz QH QH QH QH QH QHr   