
    wg                     b   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(  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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#             yy)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dCdZd ZdDd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. Z1d/ Z2d0 Z3d1 Z4d2 Z5d3 Z6d4 Z7d5 Z8d6 Z9d7 Z:d8 Z;d9 Z<d: Z=d; Z>d< Z?d= Z@d> ZAd? ZBd@ ZCdA ZDdB ZEy)E	containerz
    container(data, dtype=None, copy=True)

    Standard container-class for easy multiple-inheritance.

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

    Nc                 *    t        |||      | _         y )N)copy)r   )selfdatadtyper!   s       _/home/mcse/projects/flask/flask-venv/lib/python3.12/site-packages/numpy/lib/_user_array_impl.py__init__zcontainer.__init__    s    4T2
    c                     | j                   dkD  r8| 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__#   s^    99q=>>**T$**-=c'lm-LLL>>**S04

3CCcIIr'   c                 T    |r| j                   j                  |      S | j                   S N)r   astype)r"   ts     r%   	__array__zcontainer.__array__)   s$    ::$$Q''zzr'   c                 ,    t        | j                        S r3   )r/   r   r0   s    r%   __len__zcontainer.__len__/   s    4::r'   c                 >    | j                  | j                  |         S r3   _rcr   )r"   indexs     r%   __getitem__zcontainer.__getitem__2   s    xx

5)**r'   c                 J    t        || j                        | j                  |<   y r3   )r   r$   r   )r"   r<   values      r%   __setitem__zcontainer.__setitem__5   s    #E4::6

5r'   c                 J    | j                  t        | j                              S r3   )r;   r   r   r0   s    r%   __abs__zcontainer.__abs__8   s    xx,--r'   c                 :    | j                  | j                         S r3   r:   r0   s    r%   __neg__zcontainer.__neg__;   s    xx$$r'   c                 P    | j                  | j                  t        |      z         S r3   r;   r   r   r"   others     r%   __add__zcontainer.__add__>       xx

WU^344r'   c                 H    t        | j                  || j                         | S r3   )r   r   rG   s     r%   __iadd__zcontainer.__iadd__C   s    DJJtzz*r'   c                 P    | j                  | j                  t        |      z
        S r3   rF   rG   s     r%   __sub__zcontainer.__sub__G   rJ   r'   c                 P    | j                  t        |      | j                  z
        S r3   )r;   r   r   rG   s     r%   __rsub__zcontainer.__rsub__J   s    xx344r'   c                 H    t        | j                  || j                         | S r3   )r   r   rG   s     r%   __isub__zcontainer.__isub__M       UDJJ/r'   c                 ^    | j                  t        | j                  t        |                  S r3   )r;   r   r   r   rG   s     r%   __mul__zcontainer.__mul__Q   s     xxWU^<==r'   c                 H    t        | j                  || j                         | S r3   )r   r   rG   s     r%   __imul__zcontainer.__imul__V   rS   r'   c                 ^    | j                  t        | j                  t        |                  S r3   )r;   r	   r   r   rG   s     r%   __div__zcontainer.__div__Z   s     xxtzz75>:;;r'   c                 ^    | j                  t        t        |      | j                              S r3   )r;   r	   r   r   rG   s     r%   __rdiv__zcontainer.__rdiv__]   s     xxwu~tzz:;;r'   c                 H    t        | j                  || j                         | S r3   )r	   r   rG   s     r%   __idiv__zcontainer.__idiv__`   s    tzz5$**-r'   c                 L    | j                  t        | j                  |            S r3   r;   r
   r   rG   s     r%   __mod__zcontainer.__mod__d       xx	$**e455r'   c                 L    | j                  t        || j                              S r3   r_   rG   s     r%   __rmod__zcontainer.__rmod__g   s    xx	%455r'   c                 H    t        | j                  || j                         | S r3   )r
   r   rG   s     r%   __imod__zcontainer.__imod__j   s    $**eTZZ0r'   c                     | j                  t        | j                  |            | j                  t        | j                  |            fS r3   r;   r	   r   r
   rG   s     r%   
__divmod__zcontainer.__divmod__n   s:    

E234::u568 	8r'   c                     | j                  t        || j                              | j                  t        || j                              fS r3   rg   rG   s     r%   __rdivmod__zcontainer.__rdivmod__r   s:    tzz235$**568 	8r'   c                 ^    | j                  t        | j                  t        |                  S r3   )r;   r   r   r   rG   s     r%   __pow__zcontainer.__pow__v   s     xxdjj'%.9::r'   c                 ^    | j                  t        t        |      | j                              S r3   )r;   r   r   r   rG   s     r%   __rpow__zcontainer.__rpow__y   s     xxgendjj9::r'   c                 H    t        | j                  || j                         | S r3   )r   r   rG   s     r%   __ipow__zcontainer.__ipow__|   s    djj%,r'   c                 L    | j                  t        | j                  |            S r3   r;   r   r   rG   s     r%   
__lshift__zcontainer.__lshift__       xx
4::u566r'   c                 L    | j                  t        | j                  |            S r3   r;   r   r   rG   s     r%   
__rshift__zcontainer.__rshift__       xxDJJ677r'   c                 L    | j                  t        || j                              S r3   rr   rG   s     r%   __rlshift__zcontainer.__rlshift__       xx
5$**566r'   c                 L    | j                  t        || j                              S r3   rv   rG   s     r%   __rrshift__zcontainer.__rrshift__       xxE4::677r'   c                 H    t        | j                  || j                         | S r3   )r   r   rG   s     r%   __ilshift__zcontainer.__ilshift__       4::udjj1r'   c                 H    t        | j                  || j                         | S r3   )r   r   rG   s     r%   __irshift__zcontainer.__irshift__       DJJtzz2r'   c                 L    | j                  t        | j                  |            S r3   r;   r   r   rG   s     r%   __and__zcontainer.__and__   rx   r'   c                 L    | j                  t        || j                              S r3   r   rG   s     r%   __rand__zcontainer.__rand__   r~   r'   c                 H    t        | j                  || j                         | S r3   )r   r   rG   s     r%   __iand__zcontainer.__iand__   r   r'   c                 L    | j                  t        | j                  |            S r3   r;   r   r   rG   s     r%   __xor__zcontainer.__xor__   rx   r'   c                 L    | j                  t        || j                              S r3   r   rG   s     r%   __rxor__zcontainer.__rxor__   r~   r'   c                 H    t        | j                  || j                         | S r3   )r   r   rG   s     r%   __ixor__zcontainer.__ixor__   r   r'   c                 L    | j                  t        | j                  |            S r3   r;   r   r   rG   s     r%   __or__zcontainer.__or__   rt   r'   c                 L    | j                  t        || j                              S r3   r   rG   s     r%   __ror__zcontainer.__ror__   r{   r'   c                 H    t        | j                  || j                         | S r3   )r   r   rG   s     r%   __ior__zcontainer.__ior__   r   r'   c                 8    | j                  | j                        S r3   r:   r0   s    r%   __pos__zcontainer.__pos__   s    xx

##r'   c                 J    | j                  t        | j                              S r3   )r;   r   r   r0   s    r%   
__invert__zcontainer.__invert__   s    xxtzz*++r'   c                 L    | 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   s-    99>Q= HJ Jr'   c                 ,    | j                  t              S r3   )r   complexr0   s    r%   __complex__zcontainer.__complex__   s    ((r'   c                 ,    | j                  t              S r3   )r   floatr0   s    r%   	__float__zcontainer.__float__   s    &&r'   c                 ,    | j                  t              S r3   )r   intr0   s    r%   __int__zcontainer.__int__       $$r'   c                 ,    | j                  t              S r3   )r   hexr0   s    r%   __hex__zcontainer.__hex__   r   r'   c                 ,    | j                  t              S r3   )r   octr0   s    r%   __oct__zcontainer.__oct__   r   r'   c                 L    | j                  t        | j                  |            S r3   )r;   r   r   rG   s     r%   __lt__zcontainer.__lt__   s    xxTZZ/00r'   c                 L    | j                  t        | j                  |            S r3   )r;   r   r   rG   s     r%   __le__zcontainer.__le__   rt   r'   c                 L    | j                  t        | j                  |            S r3   )r;   r   r   rG   s     r%   __eq__zcontainer.__eq__   s    xxdjj%011r'   c                 L    | j                  t        | j                  |            S r3   )r;   r   r   rG   s     r%   __ne__zcontainer.__ne__   ra   r'   c                 L    | j                  t        | j                  |            S r3   )r;   r   r   rG   s     r%   __gt__zcontainer.__gt__   s    xx

E233r'   c                 L    | j                  t        | j                  |            S r3   )r;   r   r   rG   s     r%   __ge__zcontainer.__ge__   s    xxdjj%899r'   c                 T    | j                  | j                  j                               S  )r;   r   r!   r0   s    r%   r!   zcontainer.copy   s    xx

)**r'   c                 6    | j                   j                         S r   )r   tostringr0   s    r%   r   zcontainer.tostring   s    zz""$$r'   c                 6    | j                   j                         S r   )r   tobytesr0   s    r%   r   zcontainer.tobytes   s    zz!!##r'   c                 T    | j                  | j                  j                               S r   )r;   r   byteswapr0   s    r%   r   zcontainer.byteswap   s    xx

++-..r'   c                 V    | j                  | j                  j                  |            S r   )r;   r   r4   )r"   typecodes     r%   r4   zcontainer.astype   s     xx

))(344r'   c                 V    t        t        |            dk(  r|S | j                  |      S Nr   )r/   r   r,   )r"   as     r%   r;   zcontainer._rc   s&    uQx=AH>>!$$r'   c                 *    | j                  |d         S r   )r,   )r"   argss     r%   __array_wrap__zcontainer.__array_wrap__   s    ~~d1g&&r'   c                     |dk(  rt         j                  | ||       y 	 | j                  j                  ||       y # t        $ r t         j                  | ||       Y y w xY wNr   )object__setattr__r   AttributeError)r"   attrr?   s      r%   r   zcontainer.__setattr__   sX    7?tT51	2JJ""4/ 	2tT51	2s   <  AAc                 n    |dk(  rt         j                  | |      S | j                  j                  |      S r   )r   __getattribute__r   )r"   r   s     r%   __getattr__zcontainer.__getattr__  s1    GO**466zz**4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      sW   3J+7.%5 H55> H<<6688;;7878888877$,J)'%%%17264:+%$/5%'2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      s9         x1 x1| z6%=*-D	4B	#b'N	%)RXX"1"bqb&zH	(OHTN	(4."T(#	#h-"
r
!DQ$7
78	$x
tD3$789	$x'&*eHo>>
?@	'(F
#$	)H
# r'   