a
    i‚jG  ã                   @   sÀ   d Z ddlmZ ddlmZ G dd„ deƒZdd„ Zedkr¼dd	lm	Z	 e	j
Zg Zd
d„ ZeeƒeƒZeƒ  ej dkszJ ‚ejjdksŠJ ‚ejdks˜J ‚ejeu s¦J ‚ejeu s´J ‚es¼J ‚dS )z6Simplistic wrapper decorator for Python-coded wrappersé    )ÚCurry)ÚMODULE_ANNOTATIONSc                   @   s   e Zd ZdZdS )Ú_LazyWrapperz2Marker to tell us that an object is a lazy wrapperN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__© r	   r	   úP/home/ghrups/robot-bench/.venv/lib/python3.9/site-packages/OpenGL/lazywrapper.pyr      s   r   c                    s   ‡ fdd„}|S )aÂ  Produce a lazy-binding decorator that uses baseFunction

    Allows simple implementation of wrappers where the
    whole of the wrapper can be summed up as do 1 thing
    then call base function with the cleaned up result.

    Passes baseFunction in as the first argument of the
    wrapped function, all other parameters are passed
    unchanged.  The wrapper class created has __nonzero__
    and similar common wrapper entry points defined.
    c                    sp   ‡ fdd„}‡ fdd„}t | jtf|| j||ˆ t| dtˆ ddƒƒdœƒ}|| ˆ ƒ}| j|_tˆ dƒrlˆ j|_|S )	zWrap wrapper with baseFunctionc                    s   t ˆ ƒS )N)Úbool©Úself©ÚbaseFunctionr	   r
   Ú__bool__   s    z$lazy.<locals>.wrap.<locals>.__bool__c                    s   ddˆ j f S )Nz%s( %r )zOpenGL.lazywrapper.lazy)r   r   r   r	   r
   Ú__repr__   s    þz$lazy.<locals>.wrap.<locals>.__repr__ÚrestypeN)r   r   Ú__nonzero__r   ZwrappedOperationr   r   )Útyper   r   r   ÚgetattrÚhasattrr   )Úwrapperr   r   Z_with_wrapperZwith_wrapperr   r	   r
   Úwrap   s    
ú

zlazy.<locals>.wrapr	   )r   r   r	   r   r
   Úlazy   s    r   Ú__main__)ÚGLUc                 C   s   t  | ¡ dS )ÚTestingN)ÚoutputÚappend)Úbaser	   r	   r
   Útestwrap1   s    r    r   N)r   ZOpenGL.latebindr   ZOpenGLr   r   r   r   Z
OpenGL.rawr   ZgluNurbsCallbackDataÚfuncr   r    ZtestlazyÚ	__class__r   ZwrapperFunctionr	   r	   r	   r
   Ú<module>   s"   %