
    Ui                        d dl Z d dlmZmZmZmZ d dlZddlT ddl	mZ ddl	m
Z
 ej        ZdZd Zd	gZd
 Zej        D ]CZ eee          Z ee
edz             Zer  eee          e          neZe e            e<   DdS )    N)is_cupyis_jaxscipy_namespace_forSCIPY_ARRAY_API   )*)_ndimage_api)_delegatorsndimagec                    t          | t          j        t          j        z            r                    |           S t          | t
          t          z            r$ t          |           fd| D                       S | S )z4Convert arrays/scalars hiding in the sequence `arg`.c              3   8   K   | ]}t          |          V  d S N)_maybe_convert_arg).0xxps     /var/www/development/aibuddy-work/election-extract/venv/lib/python3.11/site-packages/scipy/ndimage/_support_alternative_backends.py	<genexpr>z%_maybe_convert_arg.<locals>.<genexpr>   s.      @@q+Ar22@@@@@@    )
isinstancenpndarraygenericasarraylisttupletype)argr   s    `r   r   r      st    #rzBJ.// zz#	C	&	& tCyy@@@@C@@@@@@
r   vectorized_filterc                       fd}|S )Nc                 L     t          j                    fd            }|S )Nc                    	  
| i |	t          	          rGj        t          vr9dd l}|                    d           }t          |j                  } || i |S t          	          rGj        dk    r<t          	          }t          |          }t          |j                  } || i |S  | i |}t          |t          j
        t          j        z            r	                    |          S t          |t                    r|S t          |t                    r 	fd|                                D             S ||S t!          |	          S )Nr   zcupyx.scipy.map_coordinatesc                 r    i | ]3\  }}|                                 t          fd |D                       4S )c              3   B   K   | ]}                     |          V  d S r   )r   )r   vvr   s     r   r   zIdelegate_xp.<locals>.inner.<locals>.wrapper.<locals>.<dictcomp>.<genexpr>>   s-      'C'C2

2'C'C'C'C'C'Cr   )itemr   )r   kvr   s      r   
<dictcomp>z?delegate_xp.<locals>.inner.<locals>.wrapper.<locals>.<dictcomp>=   sT       Aa %'C'C'C'C'C'C'C"C"C  r   )r   __name__CUPY_BLOCKLIST	importlibimport_modulegetattrr   r   r   r   r   r   r   intdictitemsr   )argskwdsr-   cupyx_module
cupyx_funcspx
jax_modulejax_funcresultr   	delegatorfuncmodule_names            @r   wrapperz+delegate_xp.<locals>.inner.<locals>.wrapper!   s   D)D))B r{{  :t}NBB    (667Sk7S7STT$\4=AA
!z404000 :1B B B)"--$S+66
":t}==x.... t,t,,fbj2:&=>> :::f---,, :!M-- :   #)<<>>    ^!M .fb999r   )	functoolswraps)r<   r>   r;   r=   s   ` r   innerzdelegate_xp.<locals>.inner    sD    			$	: $	: $	: $	: $	: $	: 
	$	:J r    )r;   r=   rA   s   `` r   delegate_xprC      s*    ' ' ' ' ' 'P Lr   
_signature)r?   scipy._lib._array_apir   r   r   r   numpyr   r	    r
   __all__MODULE_NAMEr   r,   rC   	func_namer/   	bare_funcr;   fvarsrB   r   r   <module>rN      sK                                     

    &&) ) )X % 	 	Ii00IY%=>>I 
	,Y	,	,Y	7	7	7 
 DDFF9	 	r   