B
    	Y                  @   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 7lib/python3.7/site-packages/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(   | tt |d t| |||S )N__dict__)updatevarsr   poptype__new__)clsnamebasesZ
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	
dZ eee	
dZeee	
dZeeZeeZerreeZejfd	d
ZeeZere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ree~ZeeZeeZeeZee	jZeeZee	jZee	jZee	jZee	jZe5rFee	jZee	jZee	jZd-d. Zd/d0 ZeeZd1d2 Zd3d4 Zd5d6 Zd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t| jt| | jt| j| jf S dt| jt| | jf S d S )Nr   z0<%s at 0x%x wrapping %r at 0x%x with factory %r>z<%s at 0x%x with factory %r>)r   r   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 )N)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	   r3   r   r   r   __rsub__   s    zProxy.__rsub__c             C   s
   || j  S )N)r   )r	   r3   r   r   r   __rmul__   s    zProxy.__rmul__c             C   s   t || jS )N)operatordivr   )r	   r3   r   r   r   __rdiv__   s    zProxy.__rdiv__c             C   s   t || jS )N)r7   truedivr   )r	   r3   r   r   r   __rtruediv__   s    zProxy.__rtruediv__c             C   s
   || j  S )N)r   )r	   r3   r   r   r   __rfloordiv__   s    zProxy.__rfloordiv__c             C   s
   || j  S )N)r   )r	   r3   r   r   r   __rmod__   s    zProxy.__rmod__c             C   s   t || jS )N)divmodr   )r	   r3   r   r   r   __rdivmod__   s    zProxy.__rdivmod__c             G   s   t || jf| S )N)powr   )r	   r3   r
   r   r   r   __rpow__   s    zProxy.__rpow__c             C   s
   || j > S )N)r   )r	   r3   r   r   r   __rlshift__   s    zProxy.__rlshift__c             C   s
   || j ? S )N)r   )r	   r3   r   r   r   __rrshift__   s    zProxy.__rrshift__c             C   s
   || j @ S )N)r   )r	   r3   r   r   r   __rand__   s    zProxy.__rand__c             C   s
   || j A S )N)r   )r	   r3   r   r   r   __rxor__   s    zProxy.__rxor__c             C   s
   || j B S )N)r   )r	   r3   r   r   r   __ror__   s    zProxy.__ror__c             C   s
   | j  S )N)r   	__enter__)r	   r   r   r   rG      s    zProxy.__enter__c             O   s   | j j||S )N)r   __exit__)r	   r
   kwargsr   r   r   rH      s    zProxy.__exit__c             O   s   | j ||S )N)r   )r	   r
   rI   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	   Zprotocolr   r   r   __reduce_ex__   s    zProxy.__reduce_ex__)r   r   r   r$   r&   r   r   r   r   r7   
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__boolZ__nonzero____bool__r.   r*   r2   add__add__sub__sub__mul__mul__r   r8   r:   Z__div____truediv__floordiv__floordiv__mod__mod__r>   
__divmod__r@   __pow__lshift
__lshift__rshift
__rshift__and___and__xor__xor__or___or__r4   r5   r6   r9   r;   r<   r=   r?   rA   rB   rC   rD   rE   rF   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__Z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__rG   rH   iter__iter__rJ   rK   rL   r   r   r   r   r#   B   s   	








































r#   )r7   compatr   r   r   Zutilsr   r   r   rU   r   r   r   r#   r   r   r   r   <module>   s   $