← Back
Editing: backcall.cpython-311.pyc
� a3�c� � � � d Z ddlZej d dk Z ddlmZmZ n# e$ r ddlmZmZ Y nw xY werddl m Z n ddl m Z d� Z d� ZdS ) z9 Created on Mon Jan 13 18:17:15 2014 @author: takluyver � N� )� signature� Parameter� )�wrapsc � � � � fd�}|S )Nc �F �� t �� � | � � �| _ | S )N)�_wraps�__wrapped__)�func�fs ��3/usr/lib/python3/dist-packages/backcall/backcall.py�deczwraps.<locals>.dec s# �� ��F�1�I�I�d�O�O�O� �D���K� � )r r s ` r r r s# �� � � � � � � � r c � ��� t | � � }g g c�}|j � � � D ]�\ }}|j t j t j fv rt d� � �|j t j us|j t j k r|� |� � �q�� |� � ��t � |� � ���fd�}|| _ | S )aJ Decorator to process a callback prototype. A callback prototype is a function whose signature includes all the values that will be passed by the callback API in question. The original function will be returned, with a ``prototype.adapt`` attribute which can be used to prepare third party callbacks. z**args/**kwargs not supported in prototypesc � �� ��� t � � � } |j � i � �� � S # t $ r Y nw xY w� dd� }� � � � �g }|j � � � D �]<\ }}|j t j k r?t |� � dk r|� d� � �D|� |� � �Z|j t j k rl|j t j ur|�v r�� |� � ��t |� � dk r|� d� � ��|� |� � ��|j t j k rg }��|j t j k r2|�v r�� |� � ��#|� |� � ��:i ���>|r#t d� � |� � � � �t � � � t |� � z �t% � � � � ��fd�� � }|S )z.Introspect and prepare a third party callback.Nr z)Function {!r} had unmatched arguments: {}c �\ �� | d�� } �D ]}|� |� � � �| i |��S )z@Wrapper for third party callbacks that discards excess argumentsN)�pop)�args�kwargs�name�callback�n_positional�unmatched_kws ���r �adaptedz2callback_prototype.<locals>.adapt.<locals>.adapted_ sL �� � � �� �&�D�$� !� !��� � �4� � � � ��8�T�,�V�,�,�,r )r �bind� TypeError�copy� parameters�items�kindr �POSITIONAL_ONLY�lenr �append�POSITIONAL_OR_KEYWORD�default�empty�VAR_POSITIONAL�KEYWORD_ONLY�formatr )r �sig� unmatched_pos�unrecognisedr �paramr r r r � positionals ` @@��r �adaptz!callback_prototype.<locals>.adapt1 sL ����� ���!�!�� ��C�H�j�+�F�+�+�+��O��� � � ��D� ���� #�1�1�1� � ��{�{�}�}�����>�/�/�1�1� "� "�K�D�%��z�Y�6�6�6��}�%�%��)�)�!�%�%�a�(�(�(�(� �'�'��-�-�-�-���y�>�>�>��M���8�8�t�|�?S�?S� �$�$�T�*�*�*�*���'�'�!�+�+�!�%�%�a�(�(�(�(� �'�'��-�-�-�-���y�7�7�7� "� � ���y�5�5�5��<�'�'� �$�$�T�*�*�*�*� �'�'��-�-�-�-�!��� � h��G�N�N�x�Ye�f�f�g�g�g��:����]�);�);�;�� �x��� -� -� -� -� -� -� �� -� �s �$ � 1�1)r r r! r"