
    G/Ph                        d 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  G d d          Zedk    r4 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z  dz   ee#dz            z               e! ee#d           e$ ee#d                                e! e$e# e ed           ee#                    z                        e! ee#d                      e! ee#                     dS dS )a7  
Container class for backward compatibility with NumArray.

The user_array.container class exists for backward compatibility with NumArray
and is not meant to be used in new code. If you need to create an array
container class, we recommend either creating a class that wraps an ndarray
or subclasses ndarray.

    )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	transposec                      e Zd ZdZdDdZd ZdEdZd Zd Zd	 Z	d
 Z
d Zd ZeZd Zd Zd Zd Zd ZeZd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Z d Z!d  Z"d! Z#d" Z$d# Z%d$ Z&d% Z'd& Z(d' Z)d( Z*d) Z+d* Z,d+ Z-d, Z.d- Z/d. Z0d/ Z1d0 Z2d1 Z3d2 Z4d3 Z5d4 Z6d5 Z7d6 Z8d7 Z9d8 Z:d9 Z;d: Z<d; Z=d< Z>d= Z?d> Z@d? ZAd@ ZBdA ZCdB ZDdC ZEdS )F	containerz
    container(data, dtype=None, copy=True)

    Standard container-class for easy multiple-inheritance.

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

    NTc                 4    t          |||          | _         d S )N)copy)r   )selfdatadtyper!   s       Z/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/numpy/lib/_user_array_impl.py__init__zcontainer.__init__    s    4T222


    c                     | j         dk    r6| j        j        t          | j                  t          d          d          z   S | j        j        dz   t          | j                  z   dz   S )Nr   r   ())ndim	__class____name__reprr   lenr"   s    r%   __repr__zcontainer.__repr__#   sZ    9q==>*T$*-=-=c'llmm-LLL>*S04
3C3CCcIIr'   c                 H    |r| j                             |          S | j         S N)r   astype)r"   ts     r%   	__array__zcontainer.__array__)   s(     	(:$$Q'''zr'   c                 *    t          | j                  S r3   )r/   r   r0   s    r%   __len__zcontainer.__len__/   s    4:r'   c                 B    |                      | j        |                   S r3   _rcr   )r"   indexs     r%   __getitem__zcontainer.__getitem__2   s    xx
5)***r'   c                 @    t          || j                  | j        |<   d S r3   )r   r$   r   )r"   r<   values      r%   __setitem__zcontainer.__setitem__5   s     #E4:66
5r'   c                 P    |                      t          | j                            S r3   )r;   r   r   r0   s    r%   __abs__zcontainer.__abs__8   s    xx,,---r'   c                 8    |                      | j                   S r3   r:   r0   s    r%   __neg__zcontainer.__neg__;   s    xx$$$r'   c                 V    |                      | j        t          |          z             S r3   r;   r   r   r"   others     r%   __add__zcontainer.__add__>   !    xx
WU^^3444r'   c                 <    t          | j        || j                   | S r3   )r   r   rG   s     r%   __iadd__zcontainer.__iadd__C   s    DJtz***r'   c                 V    |                      | j        t          |          z
            S r3   rF   rG   s     r%   __sub__zcontainer.__sub__G   rJ   r'   c                 V    |                      t          |          | j        z
            S r3   )r;   r   r   rG   s     r%   __rsub__zcontainer.__rsub__J   s!    xx3444r'   c                 <    t          | j        || j                   | S r3   )r   r   rG   s     r%   __isub__zcontainer.__isub__M       UDJ///r'   c                 l    |                      t          | j        t          |                              S r3   )r;   r   r   r   rG   s     r%   __mul__zcontainer.__mul__Q   s&    xxWU^^<<===r'   c                 <    t          | j        || j                   | S r3   )r   r   rG   s     r%   __imul__zcontainer.__imul__V   rS   r'   c                 l    |                      t          | j        t          |                              S r3   )r;   r	   r   r   rG   s     r%   __div__zcontainer.__div__Z   s&    xxtz75>>::;;;r'   c                 l    |                      t          t          |          | j                            S r3   )r;   r	   r   r   rG   s     r%   __rdiv__zcontainer.__rdiv__]   s&    xxwu~~tz::;;;r'   c                 <    t          | j        || j                   | S r3   )r	   r   rG   s     r%   __idiv__zcontainer.__idiv__`   s    tz5$*---r'   c                 R    |                      t          | j        |                    S r3   r;   r
   r   rG   s     r%   __mod__zcontainer.__mod__d        xx	$*e44555r'   c                 R    |                      t          || j                            S r3   r_   rG   s     r%   __rmod__zcontainer.__rmod__g   s     xx	%44555r'   c                 <    t          | j        || j                   | S r3   )r
   r   rG   s     r%   __imod__zcontainer.__imod__j   s    $*eTZ000r'   c                     |                      t          | j        |                    |                      t          | j        |                    fS r3   r;   r	   r   r
   rG   s     r%   
__divmod__zcontainer.__divmod__n   sB    
E22334:u55668 	8r'   c                     |                      t          || j                            |                      t          || j                            fS r3   rg   rG   s     r%   __rdivmod__zcontainer.__rdivmod__r   sB    tz22335$*55668 	8r'   c                 l    |                      t          | j        t          |                              S r3   )r;   r   r   r   rG   s     r%   __pow__zcontainer.__pow__v   s&    xxdj'%..99:::r'   c                 l    |                      t          t          |          | j                            S r3   )r;   r   r   r   rG   s     r%   __rpow__zcontainer.__rpow__y   s&    xxgenndj99:::r'   c                 <    t          | j        || j                   | S r3   )r   r   rG   s     r%   __ipow__zcontainer.__ipow__|   s    dj%,,,r'   c                 R    |                      t          | j        |                    S r3   r;   r   r   rG   s     r%   
__lshift__zcontainer.__lshift__        xx
4:u55666r'   c                 R    |                      t          | j        |                    S r3   r;   r   r   rG   s     r%   
__rshift__zcontainer.__rshift__        xxDJ66777r'   c                 R    |                      t          || j                            S r3   rr   rG   s     r%   __rlshift__zcontainer.__rlshift__        xx
5$*55666r'   c                 R    |                      t          || j                            S r3   rv   rG   s     r%   __rrshift__zcontainer.__rrshift__        xxE4:66777r'   c                 <    t          | j        || j                   | S r3   )r   r   rG   s     r%   __ilshift__zcontainer.__ilshift__       4:udj111r'   c                 <    t          | j        || j                   | S r3   )r   r   rG   s     r%   __irshift__zcontainer.__irshift__       DJtz222r'   c                 R    |                      t          | j        |                    S r3   r;   r   r   rG   s     r%   __and__zcontainer.__and__   rx   r'   c                 R    |                      t          || j                            S r3   r   rG   s     r%   __rand__zcontainer.__rand__   r~   r'   c                 <    t          | j        || j                   | S r3   )r   r   rG   s     r%   __iand__zcontainer.__iand__   r   r'   c                 R    |                      t          | j        |                    S r3   r;   r   r   rG   s     r%   __xor__zcontainer.__xor__   rx   r'   c                 R    |                      t          || j                            S r3   r   rG   s     r%   __rxor__zcontainer.__rxor__   r~   r'   c                 <    t          | j        || j                   | S r3   )r   r   rG   s     r%   __ixor__zcontainer.__ixor__   r   r'   c                 R    |                      t          | j        |                    S r3   r;   r   r   rG   s     r%   __or__zcontainer.__or__   rt   r'   c                 R    |                      t          || j                            S r3   r   rG   s     r%   __ror__zcontainer.__ror__   r{   r'   c                 <    t          | j        || j                   | S r3   )r   r   rG   s     r%   __ior__zcontainer.__ior__   r   r'   c                 6    |                      | j                  S r3   r:   r0   s    r%   __pos__zcontainer.__pos__   s    xx
###r'   c                 P    |                      t          | j                            S r3   )r;   r   r   r0   s    r%   
__invert__zcontainer.__invert__   s    xxtz**+++r'   c                 X    | j         dk    r || d                   S t          d          )Nr   z6only rank-0 arrays can be converted to Python scalars.)r+   	TypeError)r"   funcs     r%   _scalarfunczcontainer._scalarfunc   s7    9>>4Q== HJ J Jr'   c                 6    |                      t                    S r3   )r   complexr0   s    r%   __complex__zcontainer.__complex__   s    (((r'   c                 6    |                      t                    S r3   )r   floatr0   s    r%   	__float__zcontainer.__float__   s    &&&r'   c                 6    |                      t                    S r3   )r   intr0   s    r%   __int__zcontainer.__int__       $$$r'   c                 6    |                      t                    S r3   )r   hexr0   s    r%   __hex__zcontainer.__hex__   r   r'   c                 6    |                      t                    S r3   )r   octr0   s    r%   __oct__zcontainer.__oct__   r   r'   c                 R    |                      t          | j        |                    S r3   )r;   r   r   rG   s     r%   __lt__zcontainer.__lt__   s     xxTZ//000r'   c                 R    |                      t          | j        |                    S r3   )r;   r   r   rG   s     r%   __le__zcontainer.__le__   rt   r'   c                 R    |                      t          | j        |                    S r3   )r;   r   r   rG   s     r%   __eq__zcontainer.__eq__   s     xxdj%00111r'   c                 R    |                      t          | j        |                    S r3   )r;   r   r   rG   s     r%   __ne__zcontainer.__ne__   ra   r'   c                 R    |                      t          | j        |                    S r3   )r;   r   r   rG   s     r%   __gt__zcontainer.__gt__   s     xx
E22333r'   c                 R    |                      t          | j        |                    S r3   )r;   r   r   rG   s     r%   __ge__zcontainer.__ge__   s     xxdj%88999r'   c                 Z    |                      | j                                                  S  )r;   r   r!   r0   s    r%   r!   zcontainer.copy   s     xx
))***r'   c                 4    | j                                         S r   )r   tostringr0   s    r%   r   zcontainer.tostring   s    z""$$$r'   c                 4    | j                                         S r   )r   tobytesr0   s    r%   r   zcontainer.tobytes   s    z!!###r'   c                 Z    |                      | j                                                  S r   )r;   r   byteswapr0   s    r%   r   zcontainer.byteswap   s"    xx
++--...r'   c                 \    |                      | j                            |                    S r   )r;   r   r4   )r"   typecodes     r%   r4   zcontainer.astype   s$    xx
))(33444r'   c                 p    t          t          |                    dk    r|S |                     |          S Nr   )r/   r   r,   )r"   as     r%   r;   zcontainer._rc   s0    uQxx==AH>>!$$$r'   c                 8    |                      |d                   S r   )r,   )r"   argss     r%   __array_wrap__zcontainer.__array_wrap__   s    ~~d1g&&&r'   c                     |dk    rt                               | ||           d S 	 | j                            ||           d S # t          $ r  t                               | ||           Y d S w xY wNr   )object__setattr__r   AttributeError)r"   attrr?   s      r%   r   zcontainer.__setattr__   s    7??tT5111F	2J""4///// 	2 	2 	2tT5111111	2s   A &A-,A-c                 x    |dk    rt                               | |          S | j                            |          S r   )r   __getattribute__r   )r"   r   s     r%   __getattr__zcontainer.__getattr__  s7    GOO**4666z**4000r'   )NTr3   )Fr-   
__module____qualname____doc__r&   r1   r6   r8   r=   r@   rB   rD   rI   __radd__rL   rN   rP   rR   rU   __rmul__rW   rY   r[   r]   r`   rc   re   rh   rj   rl   rn   rp   rs   rw   rz   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   r!   r   r   r   r4   r;   r   r   r    r'   r%   r   r      s        3 3 3 3J J J     + + +7 7 7. . .% % %5 5 5 H  5 5 55 5 5  > > > H  < < << < <  6 6 66 6 6  8 8 88 8 8; ; ;; ; ;  7 7 78 8 87 7 78 8 8    8 8 88 8 8  8 8 88 8 8  7 7 77 7 7  $ $ $, , ,J J J) ) )' ' '% % %% % %% % %1 1 17 7 72 2 26 6 64 4 4: : :+ + +% % %$ $ $/ / /5 5 5% % %' ' '2 2 21 1 1 1 1r'   r   __main__i'  )d   r   N      
   )r   r   g      @g      @   g      )r   r   )%r   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   r   r-   tempuaprintdirua_smalltyper   r'   r%   <module>r      s                                                            x1 x1 x1 x1 x1 x1 x1 x1| z766%==*--D	4B	E##b''NNN	E%%))RX"1"bqb&zH	E(OOOHTN	E(4."T(###	E##h--"
r
!DDQ$7$7
7888	E$$x

ttDD3$7$788999	E$$x''&&**eeHoo>>>
?
?@@@	E''(F
#
#$$$	E))H

# r'   