
    ~f                         d Z ddlZej                  d   dk\  Z	 ddlmZmZ er
ddl	m
Z
 d Zyddl	m
Z d Z
d Zy# e$ r ddlmZmZ Y (w xY w)	z9
Created on Mon Jan 13 18:17:15 2014

@author: takluyver
    N   )	signature	Parameter   )wrapsc                       fd}|S )Nc                 8     t              |        | _        | S )N)_wraps__wrapped__)funcfs    L/var/www/cvtools/html/venv/lib/python3.12/site-packages/backcall/backcall.pydeczwraps.<locals>.dec   s    F1IdO DK     )r   r   s   ` r   r   r      s    	
 
r   c                    t        |       }g g c}|j                  j                         D ]  \  }}|j                  t        j
                  t        j                  fv rt        d      |j                  t        j                  us|j                  t        j                  k(  r|j                  |       j                  |        t        j                  |      fd}|| _        | 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 nw xY w
dd }	j                         g }|j                  j                         D ]?  \  }}|j                  t        j                  k(  r2t        |      dkD  r|j                  d       D|j                  |       V|j                  t        j                  k(  rd|j                  t        j                  ur|v rj                  |       t        |      dkD  r|j                  d       |j                  |       |j                  t        j                  k(  rg }|j                  t        j                   k(  r*|v rj                  |       +|j                  |       >i B |rt        dj#                   |            t        
      t        |      z
  t%                fd       }|S )z.Introspect and prepare a third party callback.Nr   z)Function {!r} had unmatched arguments: {}c                  N    | d } D ]  }|j                  |         | 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_   s>     &D$ !

4 ! 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   s   !	CHHj+F+O 		 #1{{}>>//1 	"KD%zzY666}%)!%%a( ''-y>>>MM8t|?S $$T*'!+!%%a( ''-y777 "y555<' $$T* ''-!-	"4 GNNxYefgg:]);;	x	- 
	- s   % 	11)r   r    r!   r"   r   r)   VAR_KEYWORDr   r'   r(   r*   r%   dictfromkeysr1   )	prototypeprotosigkeywordr   r/   r1   r   r0   s         @@r   callback_prototyper8      s     #HbJ**002 $e::)22I4I4IJJHIIMM0

i444NN4 d#$ ]]7#F9v IOr   )__doc__sysversion_infoPY3inspectr   r   ImportError_signatures	functoolsr   r
   r8   r   r   r   <module>rA      sa   
 
a2, R *R  2112s   ; A
A