
    _e	                         d Z ddlmZ dxZZej
                  r		 ddlmZmZ e G d de	      Ze G d de	      Zyy# e$ r
ZY dZ[&dZ[ww xY w)	z)Late-bound base-class (with acceleration)    )acceleratesupportN)LateBindCurryc                   2    e Zd ZdZdZd Zd Zd Zd Zd Z	y)r   zProvides a __call__ which dispatches to self._finalCall

        When called without self._finalCall() makes a call to
        self.finalise() and then calls self._finalCall()
        Nc                     || _         y)z.Set our finalCall to the callable object givenN)
_finalCall)self	finalCalls     1/usr/lib/python3/dist-packages/OpenGL/latebind.pysetFinalCallzLateBind.setFinalCall   s	    'DO    c                 \    | j                   s| j                         | _         | j                   S )z,Retrieve and/or bind and retrieve final call)r   finaliser	   s    r   getFinalCallzLateBind.getFinalCall   s     ??"&--/??"r   c                      y)z`Finalise our target to our final callable object

            return final callable
            N r   s    r   r   zLateBind.finalise   s    r   c                 4    t        | j                               S )z8Resolve our final call and check for empty/nonzero on it)boolr   r   s    r   __nonzero__zLateBind.__nonzero__    s    ))+,,r   c                     	  | j                   |i |S # t        t        f$ r=}| j                   | j                         | _          | j                   |i |cY d}~S d}~ww xY w)zCall self._finalCall, calling finalise() first if not already called

            There's actually *no* reason to unpack and repack the arguments,
            but unfortunately I don't know of a Cython syntax to specify
            that.
            N)r   	TypeErrorAttributeErrorr   )r	   argsnamederrs       r   __call__zLateBind.__call__#   s_    9&t888n- 9??*&*mmoDO&t8889s    A 2AA A )
__name__
__module____qualname____doc__r   r   r   r   r   r   r   r   r   r   r   
   s'    	
 
	(	#	
	-	9r   r   c                   $    e Zd ZdZdZdZd Zd Zy)r   zProvides a simple Curry which can bind (only) the first element

        This is used by lazywrapper, which explains the weird naming
        of the two attributes...
        Nc                      || _         || _        y)z1Stores self.wrapperFunction and self.baseFunctionN)baseFunctionwrapperFunction)r	   r%   r$   s      r   __init__zCurry.__init__9   s     ,D#2D r   c                 B     | j                   | j                  g|i |S )zAreturns self.wrapperFunction( self.baseFunction, *args, **named ))r%   r$   )r	   r   r   s      r   r   zCurry.__call__=   s%    '4''):):LTLULLr   )r   r   r    r!   r%   r$   r&   r   r   r   r   r   r   1   s    	
 	3	Mr   r   )
r!   OpenGLr   r   r   ACCELERATE_AVAILABLEOpenGL_accelerate.latebindImportErrorr   objectr   r   r   <module>r-      sk    / $ 5))> %96 %9L 	=M M S  s   > AA