Ë
    âQ(h¯  ã                   óÀ   — d dl mZ ddlZ ej                  ej                  «      j
                  d   Zda G d„ d«      ad„ Z	 G d„ de
«      Zdd	„Zd
„ Zd„ Zdd„Zd„ Zy)é   )Ú_ccallback_cé    Nc                   ó   — e Zd Zy)ÚCDataN)Ú__name__Ú
__module__Ú__qualname__© ó    úS/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/scipy/_lib/_ccallback.pyr   r   	   s   „ Ør   r   c                  ó~   — t         �y 	 dd l} | j                  «       a t         j                  ay # t        $ r da Y y w xY w)Nr   F)ÚffiÚcffiÚFFIr   ÚImportError)r   s    r   Ú_import_cffir      s<   € ô €ØðÛØ�h‰h‹jˆÜ—	‘	‰øÜò ØŠðús   ‰$. ®<»<c                   ó|   — e Zd ZdZdZdd„Zd„ Zed„ «       Zed„ «       Z	ed„ «       Z
d	„ Zedd
„«       Zedd„«       Zy)ÚLowLevelCallablea¤  
    Low-level callback function.

    Some functions in SciPy take as arguments callback functions, which
    can either be python callables or low-level compiled functions. Using
    compiled callback functions can improve performance somewhat by
    avoiding wrapping data in Python objects.

    Such low-level functions in SciPy are wrapped in `LowLevelCallable`
    objects, which can be constructed from function pointers obtained from
    ctypes, cffi, Cython, or contained in Python `PyCapsule` objects.

    .. seealso::

       Functions accepting low-level callables:

       `scipy.integrate.quad`, `scipy.ndimage.generic_filter`,
       `scipy.ndimage.generic_filter1d`, `scipy.ndimage.geometric_transform`

       Usage examples:

       :ref:`ndimage-ccallbacks`, :ref:`quad-callbacks`

    Parameters
    ----------
    function : {PyCapsule, ctypes function pointer, cffi function pointer}
        Low-level callback function.
    user_data : {PyCapsule, ctypes void pointer, cffi void pointer}
        User data to pass on to the callback function.
    signature : str, optional
        Signature of the function. If omitted, determined from *function*,
        if possible.

    Attributes
    ----------
    function
        Callback function given.
    user_data
        User data given.
    signature
        Signature of the function.

    Methods
    -------
    from_cython
        Class method for constructing callables from Cython C-exported
        functions.

    Notes
    -----
    The argument ``function`` can be one of:

    - PyCapsule, whose name contains the C function signature
    - ctypes function pointer
    - cffi function pointer

    The signature of the low-level callback must match one of those expected
    by the routine it is passed to.

    If constructing low-level functions from a PyCapsule, the name of the
    capsule must be the corresponding signature, in the format::

        return_type (arg1_type, arg2_type, ...)

    For example::

        "void (double)"
        "double (double, int *, void *)"

    The context of a PyCapsule passed in as ``function`` is used as ``user_data``,
    if an explicit value for ``user_data`` was not given.

    r
   Nc                 óZ   — | j                  |||«      }t        j                  | |||f«      S ©N)Ú_parse_callbackÚtupleÚ__new__)ÚclsÚfunctionÚ	user_dataÚ	signatureÚitems        r   r   zLowLevelCallable.__new__h   s0   € ð ×"Ñ" 8¨Y¸	ÓBˆÜ�}‰}˜S 4¨°9Ð"=Ó>Ð>r   c                 ó<   — d| j                   ›d| j                  ›d�S )NzLowLevelCallable(ú, ú))r   r   ©Úselfs    r   Ú__repr__zLowLevelCallable.__repr__n   s!   € Ø" 4§=¡=Ð"3°2°d·n±nÐ5GÀqÐIÐIr   c                 ó.   — t         j                  | d«      S )Nr   ©r   Ú__getitem__r"   s    r   r   zLowLevelCallable.functionq   ó   € ä× Ñ   qÓ)Ð)r   c                 ó.   — t         j                  | d«      S )Né   r&   r"   s    r   r   zLowLevelCallable.user_datau   r(   r   c                 óT   — t        j                  t        j                  | d«      «      S )Nr   )r   Úget_capsule_signaturer   r'   r"   s    r   r   zLowLevelCallable.signaturey   s    € ä×1Ñ1´%×2CÑ2CÀDÈ!Ó2LÓMÐMr   c                 ó   — t        «       ‚r   )Ú
ValueError)r#   Úidxs     r   r'   zLowLevelCallable.__getitem__}   s
   € Ü‹lÐr   c                 ó°   — 	 |j                   |   } | |||«      S # t        $ r}d}t        |«      |‚d}~wt        $ r}d|›d�}t        |«      |‚d}~ww xY w)a  
        Create a low-level callback function from an exported Cython function.

        Parameters
        ----------
        module : module
            Cython module where the exported function resides
        name : str
            Name of the exported function
        user_data : {PyCapsule, ctypes void pointer, cffi void pointer}, optional
            User data to pass on to the callback function.
        signature : str, optional
            Signature of the function. If omitted, determined from *function*.

        z?Given module is not a Cython module with __pyx_capi__ attributeNzNo function z$ found in __pyx_capi__ of the module)Ú__pyx_capi__ÚAttributeErrorr.   ÚKeyError)r   ÚmoduleÚnamer   r   r   ÚeÚmessages           r   Úfrom_cythonzLowLevelCallable.from_cython€   sq   € ð"	-Ø×*Ñ*¨4Ñ0ˆHñ �8˜Y¨	Ó2Ð2øô ò 	-ØWˆGÜ˜WÓ%¨1Ð,ûÜò 	-Ø$ T HÐ,PÐQˆGÜ˜WÓ%¨1Ð,ûð	-ús   ‚ ›	A¤2²A¾AÁAc                 ó,  — t        «        t        |t        «      rt        j	                  |d«      }nct        |t
        «      rt        ||«      \  }}nCt        |t        «      rt        ||«      \  }}n#t        j                  |«      r|}nt        d«      ‚t        |t        j                  «      rt        |«      }nDt        |t        «      rt        |«      }n(|€d}n#t        j                  |«      r|}nt        d«      ‚t        j                   |||«      S )Nr   zMGiven input is not a callable or a low-level callable (pycapsule/ctypes/cffi)zNGiven user data is not a valid low-level void* pointer (pycapsule/ctypes/cffi))r   Ú
isinstancer   r   r'   Ú
PyCFuncPtrÚ_get_ctypes_funcr   Ú_get_cffi_funcr   Úcheck_capsuler.   ÚctypesÚc_void_pÚ_get_ctypes_dataÚ_get_cffi_dataÚget_raw_capsule)r   Úobjr   r   ÚfuncÚcontexts         r   r   z LowLevelCallable._parse_callback›   sø   € äŒä�cÔ+Ô,Ü×$Ñ$ S¨!Ó,‰DÜ˜œZÔ(Ü.¨s°IÓ>‰OˆD‘)Ü˜œUÔ#Ü,¨S°)Ó<‰OˆD‘)Ü×'Ñ'¨Ô,Ø‰Däð Jó Kð Kô �i¤§¡Ô1Ü& yÓ1‰GÜ˜	¤5Ô)Ü$ YÓ/‰GØÐØ‰GÜ×'Ñ'¨	Ô2Ø‰Gäð Oó Pð Pô ×+Ñ+¨D°)¸WÓEÐEr   )NN)r   r   r	   Ú__doc__Ú	__slots__r   r$   Úpropertyr   r   r   r'   Úclassmethodr8   r   r
   r   r   r   r      sˆ   „ ñHðV €Ió?òJð ñ*ó ð*ð ñ*ó ð*ð ñNó ðNòð ò3ó ð3ð4 òFó ñFr   r   c                 ó(  — t        j                  | t         j                  «      j                  }|€_t	        | j
                  «      dz   }t        | j                  «      D ]*  \  }}|dk(  r|t	        |«      z  }Œ|dt	        |«      z   z  }Œ, |dz  }||fS )Nz (r   r    r!   )r?   Úcastr@   ÚvalueÚ_typename_from_ctypesÚrestypeÚ	enumerateÚargtypes)rE   r   Úfunc_ptrÚjÚargs        r   r<   r<   ¾   s–   € ä�{‰{˜4¤§¡Ó1×7Ñ7€Hð ÐÜ)¨$¯,©,Ó7¸$Ñ>ˆ	Ü §¡Ó.ò 	?‰FˆAˆsØ�AŠvØÔ2°3Ó7Ñ7‘	à˜TÔ$9¸#Ó$>Ñ>Ñ>‘	ð		?ð
 	�SÑˆ	à�YÐÐr   c                 óô   — | €y| t         j                  u ry| j                  }d}|j                  d«      r|dz  }|dd  }|j                  d«      rŒ|j                  d«      r|dd  }|dkD  r|d	d
|z  z   z  }|S )NÚvoidzvoid *r   ÚLP_r   é   Úc_r*   ú Ú*)r?   r@   r   Ú
startswith)r   r5   Úpointer_levels      r   rN   rN   Ï   s�   € Ø€|ØØ	”—‘Ñ	 Øà�=‰=€Dà€MØ
�/‰/˜%Ô
 Ø˜ÑˆØ�A�Bˆxˆð �/‰/˜%Õ
 ð ‡��tÔØ�A�Bˆxˆà�qÒØ��c˜-Ñ'Ñ'Ñ'ˆà€Kr   c                 ó^   — t        j                  | t         j                  «      j                  S r   )r?   rL   r@   rM   ©Údatas    r   rA   rA   å   s   € ä�;‰;�tœVŸ_™_Ó-×3Ñ3Ð3r   c                 óª   — t         j                  d| «      }|€8t         j                  t         j                  | «      «      j	                  dd«      }||fS )NÚ	uintptr_tz(*)rZ   )r   rL   ÚgetctypeÚtypeofÚreplace)rE   r   rR   s      r   r=   r=   î   sI   € ä�x‰x˜ TÓ*€Hð ÐÜ—L‘L¤§¡¨DÓ!1Ó2×:Ñ:¸5À#ÓFˆ	à�YÐÐr   c                 ó.   — t         j                  d| «      S )Nrb   )r   rL   r_   s    r   rB   rB   ù   s   € ä�8‰8�K Ó&Ð&r   r   )Ú r   r?   Ú	CFUNCTYPEr@   Ú	__bases__r;   r   r   r   r   r   r<   rN   rA   r=   rB   r
   r   r   ú<module>rj      sj   ðÝ ã àˆV×Ñ˜fŸo™oÓ.×8Ñ8¸Ñ;€
à
€÷	ñ 	òô]F�uô ]FóHò"ò,4óó'r   