Ë
    /æjw  ã                   ó¬  — 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j4                  z  Ze	ed
<   ej6                  j9                  dd«      Zeez  ed<   ej6                  j9                  dd«      Z  G d„ dejB                  «      Z" ed«      de#de"fd„«       Z$dedefd„Z%y)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y)Ú_ArrayClsInfor   é   é   é   N)Ú__name__Ú
__module__Ú__qualname__ÚskipÚnumpyÚ
array_likeÚunknown© ó    úa/root/repos/pocs/video-evals/.venv/lib/python3.12/site-packages/scipy/_lib/_array_api_override.pyr   r       s   „ Ø€DØ€EØ€JØ�Gr   r   éd   ÚclsÚreturnc           
      ó8  — 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 )Nz�Sparse 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Ô!ð&ˆô ˜‹oÐä�#”r—u‘u×(Ñ(Ô)ÜÐRÓSÐSä�#”r—y‘yÔ!ÜÐJÓKÐKä�#œŸ
™
¤B§J¡JÐ/Ô0Ü×"Ñ"Ð"ô
 �#œœU¤G¬T´4¸³:Ð>Ô?Ü×!Ñ!Ð!ä× Ñ Ð r   Úarraysc                  ó  — t         st        S g }g }| D �]<  }t        t        |«      «      }|t        j
                  u rŒ+|t        j                  u ry|j                  j                  dv r|j                  |«       Œg|j                  j                  dk(  rt        |«      r|j                  |«       Œ�t        d|j                  ›d�«      ‚|t        j                  u rt        |«      r|j                  |«       Œå	 t        j                  |«      }|j                  j                  dvrt        d|j                  ›d�«      ‚|j                  |«       �Œ? |st        S t!        j"                  g |¢|¢­Ž S # t        $ r t        d«      ‚w xY w)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àó 'ˆÜ&¤t¨E£{Ó3ˆØ”}×)Ñ)Ñ)Øàœ×,Ñ,Ñ,Ø�{‰{×Ñ 7Ñ*Ø×#Ñ# EÕ*Ø—‘×!Ñ! SÒ(¬\¸%Ô-@ð ×!Ñ! %Õ(äÐ"9¸%¿+¹+¸ð ISð !Só Tð Tð œ×.Ñ.Ñ.Ô3CÀEÔ3JØ×Ñ˜eÕ$ð7ÜŸ™ eÓ,�ð �{‰{×Ñ wÑ.ÜÐ"9¸%¿+¹+¸ð ISð !Só Tð Tà×Ñ Ö&ð;'ñB ÜÐô ×+Ñ+ÐG¨\ÐG¸JÒGÐGøô ò 7Üð !6ó 7ð 7ð7ús   Ã9E2Å2F)&Ú__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ß FÝ (ð €€yÓ Ø˜sŸ}™}Ñ,€	ˆ9Ó ,ð !Ÿj™jŸn™nÐ->ÀÓF€��t‘Ó Fà�z‰z�~‰~˜n¨eÓ4€ô�D—I‘Iô ñ ˆ3ƒð!˜Tð ! mò !ó ð!ð:QH˜Uð QH zô QHr   