a
    ;¹§eˆe  ã                   @  s.  d dl mZ ddlmZmZmZmZmZmZm	Z	m
Z
mZ ddlmZ d dlZdddœdd	„Zdddœd
d„Zdddœdd„Zddddœdd„Zdddœdd„Zdddœdd„Zdddœdd„Zddddœdd„Zdddœdd„Zddddœdd„Zddddœdd„Zdddœdd „Zddddœd!d"„Zddddœd#d$„Zddddœd%d&„Zdddœd'd(„Zdddœd)d*„Z dddœd+d,„Z!dddœd-d.„Z"ddddœd/d0„Z#ddddœd1d2„Z$dddœd3d4„Z%dddœd5d6„Z&dddœd7d8„Z'ddddœd9d:„Z(ddddœd;d<„Z)ddddœd=d>„Z*dddœd?d@„Z+dddœdAdB„Z,dddœdCdD„Z-dddœdEdF„Z.ddddœdGdH„Z/ddddœdIdJ„Z0dddœdKdL„Z1dddœdMdN„Z2dddœdOdP„Z3dddœdQdR„Z4ddddœdSdT„Z5ddddœdUdV„Z6dddœdWdX„Z7ddddœdYdZ„Z8ddddœd[d\„Z9ddddœd]d^„Z:dddœd_d`„Z;ddddœdadb„Z<dddœdcdd„Z=ddddœdedf„Z>dddœdgdh„Z?ddddœdidj„Z@dddœdkdl„ZAdddœdmdn„ZBdddœdodp„ZCdddœdqdr„ZDdddœdsdt„ZEdddœdudv„ZFddddœdwdx„ZGdddœdydz„ZHdddœd{d|„ZIdddœd}d~„ZJdS )é    )Úannotationsé   )	Ú_boolean_dtypesÚ_floating_dtypesÚ_real_floating_dtypesÚ_complex_floating_dtypesÚ_integer_dtypesÚ_integer_or_boolean_dtypesÚ_real_numeric_dtypesÚ_numeric_dtypesÚ_result_type)ÚArrayNr   )ÚxÚreturnc                C  s$   | j tvrtdƒ‚t t | j¡¡S )zv
    Array API compatible wrapper for :py:func:`np.abs <numpy.abs>`.

    See its docstring for more information.
    z&Only numeric dtypes are allowed in abs)Údtyper   Ú	TypeErrorr   Ú_newÚnpÚabsÚ_array©r   © r   úZ/var/www/sunrise/env/lib/python3.9/site-packages/numpy/array_api/_elementwise_functions.pyr      s    
r   c                C  s$   | j tvrtdƒ‚t t | j¡¡S )z|
    Array API compatible wrapper for :py:func:`np.arccos <numpy.arccos>`.

    See its docstring for more information.
    z.Only floating-point dtypes are allowed in acos)r   r   r   r   r   r   Zarccosr   r   r   r   r   Úacos   s    
r   c                C  s$   | j tvrtdƒ‚t t | j¡¡S )z~
    Array API compatible wrapper for :py:func:`np.arccosh <numpy.arccosh>`.

    See its docstring for more information.
    z/Only floating-point dtypes are allowed in acosh)r   r   r   r   r   r   Zarccoshr   r   r   r   r   Úacosh+   s    
r   )Úx1Úx2r   c                C  sP   | j tvs|j tvrtdƒ‚t| j |j ƒ t | |¡\} }t t | j	|j	¡¡S )zv
    Array API compatible wrapper for :py:func:`np.add <numpy.add>`.

    See its docstring for more information.
    z&Only numeric dtypes are allowed in add)
r   r   r   r   r   Ú_normalize_two_argsr   r   Úaddr   ©r   r   r   r   r   r   6   s
    r   c                C  s$   | j tvrtdƒ‚t t | j¡¡S )z|
    Array API compatible wrapper for :py:func:`np.arcsin <numpy.arcsin>`.

    See its docstring for more information.
    z.Only floating-point dtypes are allowed in asin)r   r   r   r   r   r   Zarcsinr   r   r   r   r   ÚasinE   s    
r    c                C  s$   | j tvrtdƒ‚t t | j¡¡S )z~
    Array API compatible wrapper for :py:func:`np.arcsinh <numpy.arcsinh>`.

    See its docstring for more information.
    z/Only floating-point dtypes are allowed in asinh)r   r   r   r   r   r   Zarcsinhr   r   r   r   r   ÚasinhQ   s    
r!   c                C  s$   | j tvrtdƒ‚t t | j¡¡S )z|
    Array API compatible wrapper for :py:func:`np.arctan <numpy.arctan>`.

    See its docstring for more information.
    z.Only floating-point dtypes are allowed in atan)r   r   r   r   r   r   Zarctanr   r   r   r   r   Úatan]   s    
r"   c                C  sP   | j tvs|j tvrtdƒ‚t| j |j ƒ t | |¡\} }t t | j	|j	¡¡S )z~
    Array API compatible wrapper for :py:func:`np.arctan2 <numpy.arctan2>`.

    See its docstring for more information.
    z4Only real floating-point dtypes are allowed in atan2)
r   r   r   r   r   r   r   r   Zarctan2r   r   r   r   r   Úatan2i   s
    r#   c                C  s$   | j tvrtdƒ‚t t | j¡¡S )z~
    Array API compatible wrapper for :py:func:`np.arctanh <numpy.arctanh>`.

    See its docstring for more information.
    z/Only floating-point dtypes are allowed in atanh)r   r   r   r   r   r   Zarctanhr   r   r   r   r   Úatanhx   s    
r$   c                C  sP   | j tvs|j tvrtdƒ‚t| j |j ƒ t | |¡\} }t t | j	|j	¡¡S )z†
    Array API compatible wrapper for :py:func:`np.bitwise_and <numpy.bitwise_and>`.

    See its docstring for more information.
    z9Only integer or boolean dtypes are allowed in bitwise_and)
r   r	   r   r   r   r   r   r   Úbitwise_andr   r   r   r   r   r%   ƒ   s    ÿþr%   c                C  sh   | j tvs|j tvrtdƒ‚t| j |j ƒ t | |¡\} }t |jdk ¡rRt	dƒ‚t 
t | j|j¡¡S )z„
    Array API compatible wrapper for :py:func:`np.left_shift <numpy.left_shift>`.

    See its docstring for more information.
    z5Only integer dtypes are allowed in bitwise_left_shiftr   z6bitwise_left_shift(x1, x2) is only defined for x2 >= 0)r   r   r   r   r   r   r   Úanyr   Ú
ValueErrorr   Z
left_shiftr   r   r   r   Úbitwise_left_shift•   s    r(   c                C  s$   | j tvrtdƒ‚t t | j¡¡S )z|
    Array API compatible wrapper for :py:func:`np.invert <numpy.invert>`.

    See its docstring for more information.
    z<Only integer or boolean dtypes are allowed in bitwise_invert)r   r	   r   r   r   r   Úinvertr   r   r   r   r   Úbitwise_invert§   s    
r*   c                C  sP   | j tvs|j tvrtdƒ‚t| j |j ƒ t | |¡\} }t t | j	|j	¡¡S )z„
    Array API compatible wrapper for :py:func:`np.bitwise_or <numpy.bitwise_or>`.

    See its docstring for more information.
    z8Only integer or boolean dtypes are allowed in bitwise_or)
r   r	   r   r   r   r   r   r   Ú
bitwise_orr   r   r   r   r   r+   ²   s    ÿþr+   c                C  sh   | j tvs|j tvrtdƒ‚t| j |j ƒ t | |¡\} }t |jdk ¡rRt	dƒ‚t 
t | j|j¡¡S )z†
    Array API compatible wrapper for :py:func:`np.right_shift <numpy.right_shift>`.

    See its docstring for more information.
    z6Only integer dtypes are allowed in bitwise_right_shiftr   z7bitwise_right_shift(x1, x2) is only defined for x2 >= 0)r   r   r   r   r   r   r   r&   r   r'   r   Zright_shiftr   r   r   r   Úbitwise_right_shiftÄ   s    r,   c                C  sP   | j tvs|j tvrtdƒ‚t| j |j ƒ t | |¡\} }t t | j	|j	¡¡S )z†
    Array API compatible wrapper for :py:func:`np.bitwise_xor <numpy.bitwise_xor>`.

    See its docstring for more information.
    z9Only integer or boolean dtypes are allowed in bitwise_xor)
r   r	   r   r   r   r   r   r   Úbitwise_xorr   r   r   r   r   r-   Õ   s    ÿþr-   c                C  s2   | j tvrtdƒ‚| j tv r | S t t | j¡¡S )zx
    Array API compatible wrapper for :py:func:`np.ceil <numpy.ceil>`.

    See its docstring for more information.
    z,Only real numeric dtypes are allowed in ceil)	r   r
   r   r   r   r   r   Úceilr   r   r   r   r   r.   æ   s
    

r.   c                C  s"   | j tvrtdƒ‚t t | ¡¡S )zx
    Array API compatible wrapper for :py:func:`np.conj <numpy.conj>`.

    See its docstring for more information.
    z6Only complex floating-point dtypes are allowed in conj)r   r   r   r   r   r   Úconjr   r   r   r   r/   ô   s    
r/   c                C  s$   | j tvrtdƒ‚t t | j¡¡S )zv
    Array API compatible wrapper for :py:func:`np.cos <numpy.cos>`.

    See its docstring for more information.
    z-Only floating-point dtypes are allowed in cos)r   r   r   r   r   r   Úcosr   r   r   r   r   r0   ÿ   s    
r0   c                C  s$   | j tvrtdƒ‚t t | j¡¡S )zx
    Array API compatible wrapper for :py:func:`np.cosh <numpy.cosh>`.

    See its docstring for more information.
    z.Only floating-point dtypes are allowed in cosh)r   r   r   r   r   r   Úcoshr   r   r   r   r   r1   
  s    
r1   c                C  sP   | j tvs|j tvrtdƒ‚t| j |j ƒ t | |¡\} }t t | j	|j	¡¡S )z|
    Array API compatible wrapper for :py:func:`np.divide <numpy.divide>`.

    See its docstring for more information.
    z0Only floating-point dtypes are allowed in divide)
r   r   r   r   r   r   r   r   Údivider   r   r   r   r   r2     s
    r2   c                C  s4   t | j|jƒ t | |¡\} }t t | j|j¡¡S )zz
    Array API compatible wrapper for :py:func:`np.equal <numpy.equal>`.

    See its docstring for more information.
    )r   r   r   r   r   r   Úequalr   r   r   r   r   r3   #  s    r3   c                C  s$   | j tvrtdƒ‚t t | j¡¡S )zv
    Array API compatible wrapper for :py:func:`np.exp <numpy.exp>`.

    See its docstring for more information.
    z-Only floating-point dtypes are allowed in exp)r   r   r   r   r   r   Úexpr   r   r   r   r   r4   /  s    
r4   c                C  s$   | j tvrtdƒ‚t t | j¡¡S )zz
    Array API compatible wrapper for :py:func:`np.expm1 <numpy.expm1>`.

    See its docstring for more information.
    z/Only floating-point dtypes are allowed in expm1)r   r   r   r   r   r   Úexpm1r   r   r   r   r   r5   :  s    
r5   c                C  s2   | j tvrtdƒ‚| j tv r | S t t | j¡¡S )zz
    Array API compatible wrapper for :py:func:`np.floor <numpy.floor>`.

    See its docstring for more information.
    z-Only real numeric dtypes are allowed in floor)	r   r
   r   r   r   r   r   Úfloorr   r   r   r   r   r6   E  s
    

r6   c                C  sP   | j tvs|j tvrtdƒ‚t| j |j ƒ t | |¡\} }t t | j	|j	¡¡S )zˆ
    Array API compatible wrapper for :py:func:`np.floor_divide <numpy.floor_divide>`.

    See its docstring for more information.
    z4Only real numeric dtypes are allowed in floor_divide)
r   r
   r   r   r   r   r   r   Úfloor_divider   r   r   r   r   r7   S  s
    r7   c                C  sP   | j tvs|j tvrtdƒ‚t| j |j ƒ t | |¡\} }t t | j	|j	¡¡S )z~
    Array API compatible wrapper for :py:func:`np.greater <numpy.greater>`.

    See its docstring for more information.
    z/Only real numeric dtypes are allowed in greater)
r   r
   r   r   r   r   r   r   Úgreaterr   r   r   r   r   r8   a  s
    r8   c                C  sP   | j tvs|j tvrtdƒ‚t| j |j ƒ t | |¡\} }t t | j	|j	¡¡S )zŠ
    Array API compatible wrapper for :py:func:`np.greater_equal <numpy.greater_equal>`.

    See its docstring for more information.
    z5Only real numeric dtypes are allowed in greater_equal)
r   r
   r   r   r   r   r   r   Úgreater_equalr   r   r   r   r   r9   o  s
    r9   c                C  s"   | j tvrtdƒ‚t t | ¡¡S )zx
    Array API compatible wrapper for :py:func:`np.imag <numpy.imag>`.

    See its docstring for more information.
    z6Only complex floating-point dtypes are allowed in imag)r   r   r   r   r   r   Úimagr   r   r   r   r:   }  s    
r:   c                C  s$   | j tvrtdƒ‚t t | j¡¡S )z€
    Array API compatible wrapper for :py:func:`np.isfinite <numpy.isfinite>`.

    See its docstring for more information.
    z+Only numeric dtypes are allowed in isfinite)r   r   r   r   r   r   Úisfiniter   r   r   r   r   r;   ˆ  s    
r;   c                C  s$   | j tvrtdƒ‚t t | j¡¡S )zz
    Array API compatible wrapper for :py:func:`np.isinf <numpy.isinf>`.

    See its docstring for more information.
    z(Only numeric dtypes are allowed in isinf)r   r   r   r   r   r   Úisinfr   r   r   r   r   r<   “  s    
r<   c                C  s$   | j tvrtdƒ‚t t | j¡¡S )zz
    Array API compatible wrapper for :py:func:`np.isnan <numpy.isnan>`.

    See its docstring for more information.
    z(Only numeric dtypes are allowed in isnan)r   r   r   r   r   r   Úisnanr   r   r   r   r   r=   ž  s    
r=   c                C  sP   | j tvs|j tvrtdƒ‚t| j |j ƒ t | |¡\} }t t | j	|j	¡¡S )zx
    Array API compatible wrapper for :py:func:`np.less <numpy.less>`.

    See its docstring for more information.
    z,Only real numeric dtypes are allowed in less)
r   r
   r   r   r   r   r   r   Úlessr   r   r   r   r   r>   ©  s
    r>   c                C  sP   | j tvs|j tvrtdƒ‚t| j |j ƒ t | |¡\} }t t | j	|j	¡¡S )z„
    Array API compatible wrapper for :py:func:`np.less_equal <numpy.less_equal>`.

    See its docstring for more information.
    z2Only real numeric dtypes are allowed in less_equal)
r   r
   r   r   r   r   r   r   Ú
less_equalr   r   r   r   r   r?   ·  s
    r?   c                C  s$   | j tvrtdƒ‚t t | j¡¡S )zv
    Array API compatible wrapper for :py:func:`np.log <numpy.log>`.

    See its docstring for more information.
    z-Only floating-point dtypes are allowed in log)r   r   r   r   r   r   Úlogr   r   r   r   r   r@   Å  s    
r@   c                C  s$   | j tvrtdƒ‚t t | j¡¡S )zz
    Array API compatible wrapper for :py:func:`np.log1p <numpy.log1p>`.

    See its docstring for more information.
    z/Only floating-point dtypes are allowed in log1p)r   r   r   r   r   r   Úlog1pr   r   r   r   r   rA   Ð  s    
rA   c                C  s$   | j tvrtdƒ‚t t | j¡¡S )zx
    Array API compatible wrapper for :py:func:`np.log2 <numpy.log2>`.

    See its docstring for more information.
    z.Only floating-point dtypes are allowed in log2)r   r   r   r   r   r   Úlog2r   r   r   r   r   rB   Û  s    
rB   c                C  s$   | j tvrtdƒ‚t t | j¡¡S )zz
    Array API compatible wrapper for :py:func:`np.log10 <numpy.log10>`.

    See its docstring for more information.
    z/Only floating-point dtypes are allowed in log10)r   r   r   r   r   r   Úlog10r   r   r   r   r   rC   æ  s    
rC   c                 C  sP   | j tvs|j tvrtdƒ‚t| j |j ƒ t | |¡\} }t t | j	|j	¡¡S )z‚
    Array API compatible wrapper for :py:func:`np.logaddexp <numpy.logaddexp>`.

    See its docstring for more information.
    z8Only real floating-point dtypes are allowed in logaddexp)
r   r   r   r   r   r   r   r   Ú	logaddexpr   r   r   r   r   rD   ñ  s
    rD   c                C  sP   | j tvs|j tvrtdƒ‚t| j |j ƒ t | |¡\} }t t | j	|j	¡¡S )z†
    Array API compatible wrapper for :py:func:`np.logical_and <numpy.logical_and>`.

    See its docstring for more information.
    z.Only boolean dtypes are allowed in logical_and)
r   r   r   r   r   r   r   r   Úlogical_andr   r   r   r   r   rE   ÿ  s
    rE   c                C  s$   | j tvrtdƒ‚t t | j¡¡S )z†
    Array API compatible wrapper for :py:func:`np.logical_not <numpy.logical_not>`.

    See its docstring for more information.
    z.Only boolean dtypes are allowed in logical_not)r   r   r   r   r   r   Úlogical_notr   r   r   r   r   rF     s    
rF   c                C  sP   | j tvs|j tvrtdƒ‚t| j |j ƒ t | |¡\} }t t | j	|j	¡¡S )z„
    Array API compatible wrapper for :py:func:`np.logical_or <numpy.logical_or>`.

    See its docstring for more information.
    z-Only boolean dtypes are allowed in logical_or)
r   r   r   r   r   r   r   r   Ú
logical_orr   r   r   r   r   rG     s
    rG   c                C  sP   | j tvs|j tvrtdƒ‚t| j |j ƒ t | |¡\} }t t | j	|j	¡¡S )z†
    Array API compatible wrapper for :py:func:`np.logical_xor <numpy.logical_xor>`.

    See its docstring for more information.
    z.Only boolean dtypes are allowed in logical_xor)
r   r   r   r   r   r   r   r   Úlogical_xorr   r   r   r   r   rH   &  s
    rH   c                C  sP   | j tvs|j tvrtdƒ‚t| j |j ƒ t | |¡\} }t t | j	|j	¡¡S )z€
    Array API compatible wrapper for :py:func:`np.multiply <numpy.multiply>`.

    See its docstring for more information.
    z+Only numeric dtypes are allowed in multiply)
r   r   r   r   r   r   r   r   Úmultiplyr   r   r   r   r   rI   4  s
    rI   c                C  s$   | j tvrtdƒ‚t t | j¡¡S )z€
    Array API compatible wrapper for :py:func:`np.negative <numpy.negative>`.

    See its docstring for more information.
    z+Only numeric dtypes are allowed in negative)r   r   r   r   r   r   Únegativer   r   r   r   r   rJ   B  s    
rJ   c                C  s4   t | j|jƒ t | |¡\} }t t | j|j¡¡S )z‚
    Array API compatible wrapper for :py:func:`np.not_equal <numpy.not_equal>`.

    See its docstring for more information.
    )r   r   r   r   r   r   Ú	not_equalr   r   r   r   r   rK   M  s    rK   c                C  s$   | j tvrtdƒ‚t t | j¡¡S )z€
    Array API compatible wrapper for :py:func:`np.positive <numpy.positive>`.

    See its docstring for more information.
    z+Only numeric dtypes are allowed in positive)r   r   r   r   r   r   Úpositiver   r   r   r   r   rL   Y  s    
rL   c                C  sP   | j tvs|j tvrtdƒ‚t| j |j ƒ t | |¡\} }t t | j	|j	¡¡S )zz
    Array API compatible wrapper for :py:func:`np.power <numpy.power>`.

    See its docstring for more information.
    z&Only numeric dtypes are allowed in pow)
r   r   r   r   r   r   r   r   Úpowerr   r   r   r   r   Úpowe  s
    rN   c                C  s"   | j tvrtdƒ‚t t | ¡¡S )zx
    Array API compatible wrapper for :py:func:`np.real <numpy.real>`.

    See its docstring for more information.
    z6Only complex floating-point dtypes are allowed in real)r   r   r   r   r   r   Úrealr   r   r   r   rO   s  s    
rO   c                C  sP   | j tvs|j tvrtdƒ‚t| j |j ƒ t | |¡\} }t t | j	|j	¡¡S )z‚
    Array API compatible wrapper for :py:func:`np.remainder <numpy.remainder>`.

    See its docstring for more information.
    z1Only real numeric dtypes are allowed in remainder)
r   r
   r   r   r   r   r   r   Ú	remainderr   r   r   r   r   rP   ~  s
    rP   c                C  s$   | j tvrtdƒ‚t t | j¡¡S )zz
    Array API compatible wrapper for :py:func:`np.round <numpy.round>`.

    See its docstring for more information.
    z(Only numeric dtypes are allowed in round)r   r   r   r   r   r   Úroundr   r   r   r   r   rQ   Œ  s    
rQ   c                C  s$   | j tvrtdƒ‚t t | j¡¡S )zx
    Array API compatible wrapper for :py:func:`np.sign <numpy.sign>`.

    See its docstring for more information.
    z'Only numeric dtypes are allowed in sign)r   r   r   r   r   r   Úsignr   r   r   r   r   rR   —  s    
rR   c                C  s$   | j tvrtdƒ‚t t | j¡¡S )zv
    Array API compatible wrapper for :py:func:`np.sin <numpy.sin>`.

    See its docstring for more information.
    z-Only floating-point dtypes are allowed in sin)r   r   r   r   r   r   Úsinr   r   r   r   r   rS   ¢  s    
rS   c                C  s$   | j tvrtdƒ‚t t | j¡¡S )zx
    Array API compatible wrapper for :py:func:`np.sinh <numpy.sinh>`.

    See its docstring for more information.
    z.Only floating-point dtypes are allowed in sinh)r   r   r   r   r   r   Úsinhr   r   r   r   r   rT   ­  s    
rT   c                C  s$   | j tvrtdƒ‚t t | j¡¡S )z|
    Array API compatible wrapper for :py:func:`np.square <numpy.square>`.

    See its docstring for more information.
    z)Only numeric dtypes are allowed in square)r   r   r   r   r   r   Úsquarer   r   r   r   r   rU   ¸  s    
rU   c                C  s$   | j tvrtdƒ‚t t | j¡¡S )zx
    Array API compatible wrapper for :py:func:`np.sqrt <numpy.sqrt>`.

    See its docstring for more information.
    z.Only floating-point dtypes are allowed in sqrt)r   r   r   r   r   r   Úsqrtr   r   r   r   r   rV   Ã  s    
rV   c                C  sP   | j tvs|j tvrtdƒ‚t| j |j ƒ t | |¡\} }t t | j	|j	¡¡S )z€
    Array API compatible wrapper for :py:func:`np.subtract <numpy.subtract>`.

    See its docstring for more information.
    z+Only numeric dtypes are allowed in subtract)
r   r   r   r   r   r   r   r   Úsubtractr   r   r   r   r   rW   Î  s
    rW   c                C  s$   | j tvrtdƒ‚t t | j¡¡S )zv
    Array API compatible wrapper for :py:func:`np.tan <numpy.tan>`.

    See its docstring for more information.
    z-Only floating-point dtypes are allowed in tan)r   r   r   r   r   r   Útanr   r   r   r   r   rX   Ü  s    
rX   c                C  s$   | j tvrtdƒ‚t t | j¡¡S )zx
    Array API compatible wrapper for :py:func:`np.tanh <numpy.tanh>`.

    See its docstring for more information.
    z.Only floating-point dtypes are allowed in tanh)r   r   r   r   r   r   Útanhr   r   r   r   r   rY   ç  s    
rY   c                C  s2   | j tvrtdƒ‚| j tv r | S t t | j¡¡S )zz
    Array API compatible wrapper for :py:func:`np.trunc <numpy.trunc>`.

    See its docstring for more information.
    z-Only real numeric dtypes are allowed in trunc)	r   r
   r   r   r   r   r   Útruncr   r   r   r   r   rZ   ò  s
    

rZ   )KÚ
__future__r   Z_dtypesr   r   r   r   r   r	   r
   r   r   Z_array_objectr   Únumpyr   r   r   r   r   r    r!   r"   r#   r$   r%   r(   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rY   rZ   r   r   r   r   Ú<module>   s|   ,