
    Q3j                         d Z ddlZddlmZ ddlmZ ddlmZ ddlm	Z	 ddl
mZ  ed      Zd	e	d
eedef   gedef   f   fdZdedeeef   d
ee   fdZddgZd
ee   fdZy)z
Internal helpers
    N)Callable)wraps)	signature)
ModuleType)TypeVar_Txpreturn.c                 P     dt         dt        f   dt         dt        f   f fd}|S )a2  
    Decorator to automatically replace xp with the corresponding array module.

    Use like

    import numpy as np

    @get_xp(np)
    def func(x, /, xp, kwarg=None):
        return xp.func(x, kwarg=kwarg)

    Note that xp must be a keyword argument and come after all non-keyword
    arguments.

    f.r
   c                P    t               dt        dt        dt        f fd       }t               }|j                  |j                  j                         D cg c]  \  }}|dk7  s| c}}      }|j                  d j                   d|_        ||_        |S c c}}w )	Nargskwargsr
   c                       | di|S )Nr	    )r   r   r   r	   s     Y/DATA/.local/lib/python3.12/site-packages/sklearn/externals/array_api_compat/_internal.py	wrapped_fz(get_xp.<locals>.inner.<locals>.wrapped_f!   s    d,r,V,,    r	   )
parametersz$Array API compatibility wrapper for zk.

See the corresponding documentation in NumPy/CuPy and/or the array API
specification for more details.

)	r   objectr   replacer   items__doc____name____signature__)r   r   sigiparnew_sigr	   s   `     r   innerzget_xp.<locals>.inner    s    	q	-V 	-v 	-& 	- 
	- l++*-..*>*>*@N*@3AI*@N  
 $%%%&ZZL 1!I #*	 Os   B"
+B"
)r   r   )r	   r    s   ` r   get_xpr!      s/    "#r'" (37*; * Lr   mod_nameglobals_c                    t        j                  |       }i }t        d|j                   d|       t	        |      D ]0  }|j                  d      rt        ||      s"t        ||      ||<   2 |j                  |       t        |      S )zLImport everything from module, updating globals().
    Returns __all__.
    zfrom z	 import *_)
	importlibimport_moduleexecr   dir
startswithhasattrgetattrupdatelist)r"   r#   modobjsns        r   clone_moduler2   8   s{     
!
!(
+C D5i	($/X||C WS!_c1oDG  OOD:r   r!   r2   c                      t         S )N)__all__r   r   r   __dir__r5   L   s    Nr   )r   r&   collections.abcr   	functoolsr   inspectr   typesr   typingr   r   r!   strdictr   r.   r2   r4   r5   r   r   r   <module>r=      s     $    T]&z &hb(9':HS"W<M'MN &R3 $sF{*; S	 $ ^
$c r   