3
­?d]‰  ã               @   s�  d Z ddlmZmZmZ ddlmZmZmZm	Z	m
Z
mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZm Z  ddl!m"Z" G dd„ de#ƒZ$e%dk�rŒeedƒdƒZ&e$e&ƒZ'e(e)e'ƒƒ e(ee'ƒe'jƒ e'd
d…d
d…f Z*e(e*ƒ de*d< e(e*d e'd ƒ e(ee*ƒd d ee*d ƒ ƒ e(ee*dƒe+ee*dƒƒƒ e(e+e*eedƒee*ƒƒ ƒƒ e(ee*dƒƒ e(e e*ƒƒ d
S )z�
Standard container-class for easy multiple-inheritance.

Try to inherit from the ndarray instead of using this class as this is not
complete.

é    )ÚdivisionÚabsolute_importÚprint_function)ÚarrayÚasarrayÚabsoluteÚaddÚsubtractÚmultiplyÚdivideÚ	remainderÚpowerÚ
left_shiftÚright_shiftÚbitwise_andÚ
bitwise_orÚbitwise_xorÚinvertÚlessÚ
less_equalÚ	not_equalÚequalÚgreaterÚgreater_equalÚshapeÚreshapeÚarangeÚsinÚsqrtÚ	transpose)Úlongc               @   s  e Zd ZdZd„dd„Zdd„ Zd…dd	„Zd
d„ Zdd„ Zdd„ Z	dd„ Z
dd„ Zdd„ ZeZdd„ Zdd„ Zdd„ Zdd„ Zdd„ ZeZd d!„ Zd"d#„ Zd$d%„ Zd&d'„ Zd(d)„ Zd*d+„ Zd,d-„ Zd.d/„ Zd0d1„ Zd2d3„ Zd4d5„ Zd6d7„ Zd8d9„ Z d:d;„ Z!d<d=„ Z"d>d?„ Z#d@dA„ Z$dBdC„ Z%dDdE„ Z&dFdG„ Z'dHdI„ Z(dJdK„ Z)dLdM„ Z*dNdO„ Z+dPdQ„ Z,dRdS„ Z-dTdU„ Z.dVdW„ Z/dXdY„ Z0dZd[„ Z1d\d]„ Z2d^d_„ Z3d`da„ Z4dbdc„ Z5ddde„ Z6dfdg„ Z7dhdi„ Z8djdk„ Z9dldm„ Z:dndo„ Z;dpdq„ Z<drds„ Z=dtdu„ Z>dvdw„ Z?dxdy„ Z@dzd{„ ZAd|d}„ ZBd~d„ ZCd€d�„ ZDd‚dƒ„ ZEdS )†Ú	containerzµ
    container(data, dtype=None, copy=True)

    Standard container-class for easy multiple-inheritance.

    Methods
    -------
    copy
    tostring
    byteswap
    astype

    NTc             C   s   t |||d�| _ d S )N)Úcopy)r   )ÚselfÚdataÚdtyper"   © r&   ú5/tmp/pip-build-op5p2y5_/numpy/numpy/lib/user_array.pyÚ__init__!   s    zcontainer.__init__c             C   sF   | j dkr(| jjt| jƒtdƒd …  S | jjd t| jƒ d S d S )Nr   r   ú(ú))ÚndimÚ	__class__Ú__name__Úreprr   Úlen)r#   r&   r&   r'   Ú__repr__$   s    
zcontainer.__repr__c             C   s   |r| j j|ƒS | j S )N)r   Úastype)r#   Útr&   r&   r'   Ú	__array__*   s    zcontainer.__array__c             C   s
   t | jƒS )N)r/   r   )r#   r&   r&   r'   Ú__len__0   s    zcontainer.__len__c             C   s   | j | j| ƒS )N)Ú_rcr   )r#   Úindexr&   r&   r'   Ú__getitem__3   s    zcontainer.__getitem__c             C   s   t || jƒ| j|< d S )N)r   r%   r   )r#   r6   Úvaluer&   r&   r'   Ú__setitem__6   s    zcontainer.__setitem__c             C   s   | j t| jƒƒS )N)r5   r   r   )r#   r&   r&   r'   Ú__abs__9   s    zcontainer.__abs__c             C   s   | j | j ƒS )N)r5   r   )r#   r&   r&   r'   Ú__neg__<   s    zcontainer.__neg__c             C   s   | j | jt|ƒ ƒS )N)r5   r   r   )r#   Úotherr&   r&   r'   Ú__add__?   s    zcontainer.__add__c             C   s   t | j|| jƒ | S )N)r   r   )r#   r<   r&   r&   r'   Ú__iadd__D   s    zcontainer.__iadd__c             C   s   | j | jt|ƒ ƒS )N)r5   r   r   )r#   r<   r&   r&   r'   Ú__sub__H   s    zcontainer.__sub__c             C   s   | j t|ƒ| j ƒS )N)r5   r   r   )r#   r<   r&   r&   r'   Ú__rsub__K   s    zcontainer.__rsub__c             C   s   t | j|| jƒ | S )N)r	   r   )r#   r<   r&   r&   r'   Ú__isub__N   s    zcontainer.__isub__c             C   s   | j t| jt|ƒƒƒS )N)r5   r
   r   r   )r#   r<   r&   r&   r'   Ú__mul__R   s    zcontainer.__mul__c             C   s   t | j|| jƒ | S )N)r
   r   )r#   r<   r&   r&   r'   Ú__imul__W   s    zcontainer.__imul__c             C   s   | j t| jt|ƒƒƒS )N)r5   r   r   r   )r#   r<   r&   r&   r'   Ú__div__[   s    zcontainer.__div__c             C   s   | j tt|ƒ| jƒƒS )N)r5   r   r   r   )r#   r<   r&   r&   r'   Ú__rdiv__^   s    zcontainer.__rdiv__c             C   s   t | j|| jƒ | S )N)r   r   )r#   r<   r&   r&   r'   Ú__idiv__a   s    zcontainer.__idiv__c             C   s   | j t| j|ƒƒS )N)r5   r   r   )r#   r<   r&   r&   r'   Ú__mod__e   s    zcontainer.__mod__c             C   s   | j t|| jƒƒS )N)r5   r   r   )r#   r<   r&   r&   r'   Ú__rmod__h   s    zcontainer.__rmod__c             C   s   t | j|| jƒ | S )N)r   r   )r#   r<   r&   r&   r'   Ú__imod__k   s    zcontainer.__imod__c             C   s$   | j t| j|ƒƒ| j t| j|ƒƒfS )N)r5   r   r   r   )r#   r<   r&   r&   r'   Ú
__divmod__o   s    zcontainer.__divmod__c             C   s$   | j t|| jƒƒ| j t|| jƒƒfS )N)r5   r   r   r   )r#   r<   r&   r&   r'   Ú__rdivmod__s   s    zcontainer.__rdivmod__c             C   s   | j t| jt|ƒƒƒS )N)r5   r   r   r   )r#   r<   r&   r&   r'   Ú__pow__w   s    zcontainer.__pow__c             C   s   | j tt|ƒ| jƒƒS )N)r5   r   r   r   )r#   r<   r&   r&   r'   Ú__rpow__z   s    zcontainer.__rpow__c             C   s   t | j|| jƒ | S )N)r   r   )r#   r<   r&   r&   r'   Ú__ipow__}   s    zcontainer.__ipow__c             C   s   | j t| j|ƒƒS )N)r5   r   r   )r#   r<   r&   r&   r'   Ú
__lshift__�   s    zcontainer.__lshift__c             C   s   | j t| j|ƒƒS )N)r5   r   r   )r#   r<   r&   r&   r'   Ú
__rshift__„   s    zcontainer.__rshift__c             C   s   | j t|| jƒƒS )N)r5   r   r   )r#   r<   r&   r&   r'   Ú__rlshift__‡   s    zcontainer.__rlshift__c             C   s   | j t|| jƒƒS )N)r5   r   r   )r#   r<   r&   r&   r'   Ú__rrshift__Š   s    zcontainer.__rrshift__c             C   s   t | j|| jƒ | S )N)r   r   )r#   r<   r&   r&   r'   Ú__ilshift__�   s    zcontainer.__ilshift__c             C   s   t | j|| jƒ | S )N)r   r   )r#   r<   r&   r&   r'   Ú__irshift__‘   s    zcontainer.__irshift__c             C   s   | j t| j|ƒƒS )N)r5   r   r   )r#   r<   r&   r&   r'   Ú__and__•   s    zcontainer.__and__c             C   s   | j t|| jƒƒS )N)r5   r   r   )r#   r<   r&   r&   r'   Ú__rand__˜   s    zcontainer.__rand__c             C   s   t | j|| jƒ | S )N)r   r   )r#   r<   r&   r&   r'   Ú__iand__›   s    zcontainer.__iand__c             C   s   | j t| j|ƒƒS )N)r5   r   r   )r#   r<   r&   r&   r'   Ú__xor__Ÿ   s    zcontainer.__xor__c             C   s   | j t|| jƒƒS )N)r5   r   r   )r#   r<   r&   r&   r'   Ú__rxor__¢   s    zcontainer.__rxor__c             C   s   t | j|| jƒ | S )N)r   r   )r#   r<   r&   r&   r'   Ú__ixor__¥   s    zcontainer.__ixor__c             C   s   | j t| j|ƒƒS )N)r5   r   r   )r#   r<   r&   r&   r'   Ú__or__©   s    zcontainer.__or__c             C   s   | j t|| jƒƒS )N)r5   r   r   )r#   r<   r&   r&   r'   Ú__ror__¬   s    zcontainer.__ror__c             C   s   t | j|| jƒ | S )N)r   r   )r#   r<   r&   r&   r'   Ú__ior__¯   s    zcontainer.__ior__c             C   s   | j | jƒS )N)r5   r   )r#   r&   r&   r'   Ú__pos__³   s    zcontainer.__pos__c             C   s   | j t| jƒƒS )N)r5   r   r   )r#   r&   r&   r'   Ú
__invert__¶   s    zcontainer.__invert__c             C   s"   | j dkr|| d ƒS tdƒ‚d S )Nr   z6only rank-0 arrays can be converted to Python scalars.)r+   Ú	TypeError)r#   Úfuncr&   r&   r'   Ú_scalarfunc¹   s    
zcontainer._scalarfuncc             C   s
   | j tƒS )N)rb   Úcomplex)r#   r&   r&   r'   Ú__complex__À   s    zcontainer.__complex__c             C   s
   | j tƒS )N)rb   Úfloat)r#   r&   r&   r'   Ú	__float__Ã   s    zcontainer.__float__c             C   s
   | j tƒS )N)rb   Úint)r#   r&   r&   r'   Ú__int__Æ   s    zcontainer.__int__c             C   s
   | j tƒS )N)rb   r    )r#   r&   r&   r'   Ú__long__É   s    zcontainer.__long__c             C   s
   | j tƒS )N)rb   Úhex)r#   r&   r&   r'   Ú__hex__Ì   s    zcontainer.__hex__c             C   s
   | j tƒS )N)rb   Úoct)r#   r&   r&   r'   Ú__oct__Ï   s    zcontainer.__oct__c             C   s   | j t| j|ƒƒS )N)r5   r   r   )r#   r<   r&   r&   r'   Ú__lt__Ò   s    zcontainer.__lt__c             C   s   | j t| j|ƒƒS )N)r5   r   r   )r#   r<   r&   r&   r'   Ú__le__Õ   s    zcontainer.__le__c             C   s   | j t| j|ƒƒS )N)r5   r   r   )r#   r<   r&   r&   r'   Ú__eq__Ø   s    zcontainer.__eq__c             C   s   | j t| j|ƒƒS )N)r5   r   r   )r#   r<   r&   r&   r'   Ú__ne__Û   s    zcontainer.__ne__c             C   s   | j t| j|ƒƒS )N)r5   r   r   )r#   r<   r&   r&   r'   Ú__gt__Þ   s    zcontainer.__gt__c             C   s   | j t| j|ƒƒS )N)r5   r   r   )r#   r<   r&   r&   r'   Ú__ge__á   s    zcontainer.__ge__c             C   s   | j | jjƒ ƒS )Ú )r5   r   r"   )r#   r&   r&   r'   r"   ä   s    zcontainer.copyc             C   s
   | j jƒ S )rt   )r   Útostring)r#   r&   r&   r'   ru   è   s    zcontainer.tostringc             C   s   | j | jjƒ ƒS )rt   )r5   r   Úbyteswap)r#   r&   r&   r'   rv   ì   s    zcontainer.byteswapc             C   s   | j | jj|ƒƒS )rt   )r5   r   r1   )r#   Útypecoder&   r&   r'   r1   ð   s    zcontainer.astypec             C   s"   t t|ƒƒdkr|S | j|ƒS d S )Nr   )r/   r   r,   )r#   Úar&   r&   r'   r5   ô   s    zcontainer._rcc             G   s   | j |d ƒS )Nr   )r,   )r#   Úargsr&   r&   r'   Ú__array_wrap__ú   s    zcontainer.__array_wrap__c             C   sT   |dkrt j| ||ƒ d S y| jj||ƒ W n" tk
rN   t j| ||ƒ Y nX d S )Nr   )ÚobjectÚ__setattr__r   ÚAttributeError)r#   Úattrr8   r&   r&   r'   r|   ý   s    zcontainer.__setattr__c             C   s    |dkrt j| |ƒS | jj|ƒS )Nr   )r{   Ú__getattribute__r   )r#   r~   r&   r&   r'   Ú__getattr__  s    zcontainer.__getattr__)NT)N)Fr-   Ú
__module__Ú__qualname__Ú__doc__r(   r0   r3   r4   r7   r9   r:   r;   r=   Ú__radd__r>   r?   r@   rA   rB   Ú__rmul__rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r^   r_   rb   rd   rf   rh   ri   rk   rm   rn   ro   rp   rq   rr   rs   r"   ru   rv   r1   r5   rz   r|   r€   r&   r&   r&   r'   r!      s†   


r!   Ú__main__i'  éd   Né   é   é
   g      @g      @é   ég   é   )r‡   r‡   )r   r   )r   r   )r   r   )r‰   rˆ   ),rƒ   Ú
__future__r   r   r   Z
numpy.corer   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   Znumpy.compatr    r{   r!   r-   ÚtempZuaÚprintÚdirZua_smallÚtyper&   r&   r&   r'   Ú<module>   s&   t }
 