3
uûœ]   ã               @   s„   d dl Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ dd	„ ZG d
d„ de	ƒZ
G dd„ deƒZG dd„ deeƒƒZdS )é    Né   )ÚPY2)ÚPY3)Úwith_metaclass)Úcached_property)Úidentityc                s   ‡ fdd„}|S )Nc                s   ˆ | j f|žŽ S )N)Ú__wrapped__)ÚselfÚargs)Úcode© úE/tmp/pip-build-fn42xldr/lazy-object-proxy/lazy_object_proxy/simple.pyÚproxy_wrapper   s    z(make_proxy_method.<locals>.proxy_wrapperr   )r   r   r   )r   r   Úmake_proxy_method
   s    r   c               @   sL   e Zd Zedd„ ƒZejdd„ ƒZedd„ ƒZejdd„ ƒZedd„ ƒZd	S )
Ú_ProxyMethodsc             C   s   | j jS )N)r   Ú
__module__)r	   r   r   r   r      s    z_ProxyMethods.__module__c             C   s   || j _d S )N)r   r   )r	   Úvaluer   r   r   r      s    c             C   s   | j jS )N)r   Ú__doc__)r	   r   r   r   r   #   s    z_ProxyMethods.__doc__c             C   s   || j _d S )N)r   r   )r	   r   r   r   r   r   '   s    c             C   s   | j jS )N)r   Ú__weakref__)r	   r   r   r   r   0   s    z_ProxyMethods.__weakref__N)Ú__name__r   Ú__qualname__ÚpropertyÚsetterr   r   r   r   r   r   r      s
   
	r   c               @   s   e Zd Zdd„ ZdS )Ú_ProxyMetaTypec             C   s(   |j ttƒƒ |jdƒ tj| |||ƒS )NÚ__dict__)ÚupdateÚvarsr   ÚpopÚtypeÚ__new__)ÚclsÚnameÚbasesÚ
dictionaryr   r   r   r   6   s    
z_ProxyMetaType.__new__N)r   r   r   r   r   r   r   r   r   5   s   r   c               @   sz  e Zd ZdZdd„ Zedd„ ƒZeee	j
dƒƒƒZ eee	j
dƒƒƒZeee	j
dƒƒƒZeeƒZeeƒZerreeƒZejfd	d
„ZeeƒZer”eeƒZee	jƒZee	jƒZee	jƒZ ee	j!ƒZ"ee	j#ƒZ$ee	j%ƒZ&ee'ƒZ(ee)ƒZ*ee)ƒZ+dd„ Z,dd„ Z-dd„ Z.ee	j/ƒZ0ee	j1ƒZ2ee	j3ƒZ4ee5�r,e	j6ne	j7ƒZ8ee	j7ƒZ9ee	j:ƒZ;ee	j<ƒZ=ee>ƒZ?ee@ƒZAee	jBƒZCee	jDƒZEee	jFƒZGee	jHƒZIee	jJƒZKdd„ ZLdd„ ZMdd„ ZNdd„ ZOdd„ ZPdd„ ZQdd„ ZRdd „ ZSd!d"„ ZTd#d$„ ZUd%d&„ ZVd'd(„ ZWd)d*„ ZXd+d,„ ZYee	jZƒZ[ee	j\ƒZ]ee	j^ƒZ_ee5�r0e	j`ne	jaƒZbee	jaƒZcee	jdƒZeee	jfƒZgee	jhƒZiee	jjƒZkee	jlƒZmee	jnƒZoee	jpƒZqee	jrƒZsee	jtƒZuee	jvƒZwee	jxƒZyee	jzƒZ{ee|ƒZ}e5�rÐee~ƒZee€ƒZ�ee‚ƒZƒee„ƒZ…ee	j†ƒZ‡eeˆƒZ‰ee	jŠƒZ‹ee	jŒƒZ�ee	jŽƒZ�ee	j�ƒZ‘e5�rFee	j’ƒZ“ee	j”ƒZ•ee	j–ƒZ—d-d.„ Z˜d/d0„ Z™eešƒZ›d1d2„ Zœd3d4„ Z�d5d6„ ZždS )7ÚProxyNc             C   s   || j d< d S )NÚ__factory__)r   )r	   Úfactoryr   r   r   Ú__init__E   s    zProxy.__init__c             C   s(   | j } d| kr| d }|ƒ S tdƒ‚d S )Nr%   z4Proxy hasn't been initiated: __factory__ is missing.)r   Ú
ValueError)r	   r&   r   r   r   r   H   s
    zProxy.__wrapped__r   Ú	__class__Z__anotations__c             C   sN   d| j kr0djt| ƒjt| ƒ| jt| jƒ| jƒS djt| ƒjt| ƒ| jƒS d S )Nr   z8<{} at 0x{:x} wrapping {!r} at 0x{:x} with factory {!r}>z <{} at 0x{:x} with factory {!r}>)r   Úformatr   r   Úidr   r%   )r	   Ú__getattr__r   r   r   Ú__repr__Z   s    
zProxy.__repr__c             C   s,   t t| ƒ|ƒr|| j|< nt| j||ƒ d S )N)Úhasattrr   r   Úsetattrr   )r	   r!   r   r   r   r   Ú__setattr__v   s    zProxy.__setattr__c             C   s"   |dkrt |ƒ‚nt| j|ƒS d S )Nr   r%   )r   r%   )ÚAttributeErrorÚgetattrr   )r	   r!   r   r   r   r,   |   s    
zProxy.__getattr__c             C   s(   t t| ƒ|ƒr| j|= nt| j|ƒ d S )N)r.   r   r   Údelattrr   )r	   r!   r   r   r   Ú__delattr__‚   s    
zProxy.__delattr__c             C   s
   || j  S )N)r   )r	   Úotherr   r   r   Ú__radd__—   s    zProxy.__radd__c             C   s
   || j  S )N)r   )r	   r5   r   r   r   Ú__rsub__š   s    zProxy.__rsub__c             C   s
   || j  S )N)r   )r	   r5   r   r   r   Ú__rmul__�   s    zProxy.__rmul__c             C   s   t j|| jƒS )N)ÚoperatorÚdivr   )r	   r5   r   r   r   Ú__rdiv__    s    zProxy.__rdiv__c             C   s   t j|| jƒS )N)r9   Útruedivr   )r	   r5   r   r   r   Ú__rtruediv__£   s    zProxy.__rtruediv__c             C   s
   || j  S )N)r   )r	   r5   r   r   r   Ú__rfloordiv__¦   s    zProxy.__rfloordiv__c             C   s
   || j  S )N)r   )r	   r5   r   r   r   Ú__rmod__©   s    zProxy.__rmod__c             C   s   t || jƒS )N)Údivmodr   )r	   r5   r   r   r   Ú__rdivmod__¬   s    zProxy.__rdivmod__c             G   s   t || jf|žŽ S )N)Úpowr   )r	   r5   r
   r   r   r   Ú__rpow__¯   s    zProxy.__rpow__c             C   s
   || j > S )N)r   )r	   r5   r   r   r   Ú__rlshift__²   s    zProxy.__rlshift__c             C   s
   || j ? S )N)r   )r	   r5   r   r   r   Ú__rrshift__µ   s    zProxy.__rrshift__c             C   s
   || j @ S )N)r   )r	   r5   r   r   r   Ú__rand__¸   s    zProxy.__rand__c             C   s
   || j A S )N)r   )r	   r5   r   r   r   Ú__rxor__»   s    zProxy.__rxor__c             C   s
   || j B S )N)r   )r	   r5   r   r   r   Ú__ror__¾   s    zProxy.__ror__c             C   s
   | j jƒ S )N)r   Ú	__enter__)r	   r   r   r   rI   ç   s    zProxy.__enter__c             O   s   | j j||ŽS )N)r   Ú__exit__)r	   r
   Úkwargsr   r   r   rJ   ê   s    zProxy.__exit__c             O   s   | j ||ŽS )N)r   )r	   r
   rK   r   r   r   Ú__call__ï   s    zProxy.__call__c             C   s   t | jffS )N)r   r   )r	   r   r   r   Ú
__reduce__ò   s    zProxy.__reduce__c             C   s   t | jffS )N)r   r   )r	   Úprotocolr   r   r   Ú__reduce_ex__õ   s    zProxy.__reduce_ex__)Ÿr   r   r   r%   r'   r   r   r   r   r9   Ú
attrgetterr)   Ú__annotations__ÚdirÚ__dir__ÚstrÚ__str__r   ÚbytesÚ	__bytes__ÚobjectÚ__getattribute__r-   ÚreversedÚ__reversed__ÚroundÚ	__round__ÚltÚ__lt__ÚleÚ__le__ÚeqÚ__eq__ÚneÚ__ne__ÚgtÚ__gt__ÚgeÚ__ge__ÚhashÚ__hash__ÚboolÚ__nonzero__Ú__bool__r0   r,   r4   ÚaddÚ__add__ÚsubÚ__sub__ÚmulÚ__mul__r   r:   r<   Z__div__Ú__truediv__ÚfloordivÚ__floordiv__ÚmodÚ__mod__r@   Ú
__divmod__rB   Ú__pow__ÚlshiftÚ
__lshift__ÚrshiftÚ
__rshift__Úand_Ú__and__ÚxorÚ__xor__Úor_Ú__or__r6   r7   r8   r;   r=   r>   r?   rA   rC   rD   rE   rF   rG   rH   ÚiaddÚ__iadd__ÚisubÚ__isub__ÚimulÚ__imul__ZidivÚitruedivZ__idiv__Ú__itruediv__Ú	ifloordivÚ__ifloordiv__ÚimodÚ__imod__ÚipowÚ__ipow__ÚilshiftÚ__ilshift__ÚirshiftÚ__irshift__ÚiandÚ__iand__ÚixorÚ__ixor__ÚiorÚ__ior__ÚnegÚ__neg__ÚposÚ__pos__ÚabsÚ__abs__ÚinvertÚ
__invert__ÚintÚ__int__ÚlongZ__long__ÚfloatÚ	__float__ÚoctZ__oct__ÚhexZ__hex__ÚindexÚ	__index__ÚlenÚ__len__ÚcontainsÚ__contains__ÚgetitemÚ__getitem__ÚsetitemÚ__setitem__ÚdelitemÚ__delitem__ZgetsliceZ__getslice__ZsetsliceZ__setslice__ZdelsliceZ__delslice__rI   rJ   ÚiterÚ__iter__rL   rM   rO   r   r   r   r   r$   B   sº   	








































r$   )r9   Úcompatr   r   r   Úutilsr   r   r   rX   r   r   r   r$   r   r   r   r   Ú<module>   s   $