← Back
Editing: _ccallback.cpython-311.pyc
� d�cE � � � d dl mZ ddlZ ej ej � � j d Zda G d� d� � ad� Z G d� de � � Zdd �Zd � Z d� Zdd�Zd � ZdS )� )�_ccallback_c� Nc � � e Zd ZdS )�CDataN)�__name__� __module__�__qualname__� � �7/usr/lib/python3/dist-packages/scipy/_lib/_ccallback.pyr r s � � � � � ��Dr r c � � t �d S dd l} | � � � a t j ad S # t $ r da Y d S w xY w)Nr F)�ffi�cffi�FFIr �ImportError)r s r �_import_cffir sZ � � ����������h�h�j�j��� ������ � � ���������s �$1 �A� Ac � � e Zd ZdZdZdd�Zd� Zed� � � Zed� � � Z ed� � � Z d � Zedd �� � Z edd�� � ZdS ) �LowLevelCallablea� Low-level callback function. 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 �l � | � |||� � }t � | |||f� � S �N)�_parse_callback�tuple�__new__)�cls�function� user_data� signature�items r r zLowLevelCallable.__new__T s6 � � �"�"�8�Y� �B�B���}�}�S�4��9�"=�>�>�>r c �B � d� | j | j � � S )NzLowLevelCallable({!r}, {!r}))�formatr r ��selfs r �__repr__zLowLevelCallable.__repr__Z s � �-�4�4�T�]�D�N�S�S�Sr c �8 � t � | d� � S )Nr �r �__getitem__r! s r r zLowLevelCallable.function] � � �� � ��q�)�)�)r c �8 � t � | d� � S )N� r% r! s r r zLowLevelCallable.user_dataa r'