o
    gHd<+                     @   s  d Z 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lmZ dd	lmZ dd
lmZ ddlmZmZ ejjZejjZejjZejjZejjZej jZ!e"ej#e"ej$e"ej%e"ej&iZ'e"ej(e"ej&kre')e"ej*e"ej(i dddedfddZ+dddedfddZ,ddddedfddZ-ddddedfddZ.d4ddddZ/d4ddddZ0d5ddZ1dd Z2dd  Z3ddd!d"d#Z4d6dd$d%d&Z5d4ddd'd(Z6d7ddd)d*Z7d7ddd+d,Z8d8d-d.Z9d9d0d1Z:d9d2d3Z;dS ):zx
Array methods which are called by both the C-code for the method
and the Python code for the NumPy-namespace function

    N)nullcontext)
multiarray)umath)
asanyarray)numerictypes)_exceptions)_no_nep50_warning)_NoValue)pickle	os_fspathFTc                 C      t | |d ||||S N)umr_maximumaaxisoutkeepdimsinitialwhere r   Z/var/www/html/facialservice/flask-venv/lib/python3.10/site-packages/numpy/core/_methods.py_amax'      r   c                 C   r   r   )umr_minimumr   r   r   r   _amin+   r   r   c                 C      t | ||||||S r   )umr_sumr   r   dtyper   r   r   r   r   r   r   _sum/   r   r    c                 C   r   r   )umr_prodr   r   r   r   _prod3   r   r"   r   c                C   ,   |du rt | ||||S t | |||||dS NTr#   )umr_anyr   r   r   r   r   r   r   r   r   _any7      r(   c                C   r$   r%   )umr_allr'   r   r   r   _all=   r)   r+   c                 C   s   |du r2|d u rt t| j}nt|t s|f}d}|D ]}|| jt|| j 9 }qt|}|S ddl	m
} t||| j|tjd |}|S )NT   r   )broadcast_to)tuplerangendim
isinstanceshapemunormalize_axis_indexntintpnumpy.lib.stride_tricksr-   r   )arrr   r   r   itemsaxr-   r   r   r   _count_reduce_itemsC   s   


r;   c                 C   s>   ddl m} || dkrdS zt| W S  ty   Y dS w )Nr   )r0   F)numpy.core.fromnumericr0   umisnan	TypeError)r   r0   r   r   r   _clip_dep_is_scalar_nan]   s   r@   c                 C   s   t | tjr| jj S dS )NF)r1   r3   ndarrayr   isnative)r   r   r   r   _clip_dep_is_byte_swappedg   s   
rC   r   castingc             
   O   s   |d ur| |||d|S z
| |d|i|W S  t jyC } ztjd|j|jtdd | ||dd|W  Y d }~S d }~ww )NrD   r   zConverting the output of clip from {!r} to {!r} is deprecated. Pass `casting="unsafe"` explicitly to silence this warning, or correct the type of the variables.   
stacklevelunsafe)r   _UFuncOutputCastingErrorwarningswarnformatfrom_toDeprecationWarning)ufuncr   rE   argskwargser   r   r   _clip_dep_invoke_with_castingl   s    rU   )rE   c                K   s   |d u r|d u rt dt| s5t|s5d}t|r!td }d}t|r+td}d}|r5tjdtdd |d u rGttj	| |f||d|S |d u rYttj
| |f||d|S ttj| ||f||d|S )	NzOne of max or min must be givenFinfTa  Passing `np.nan` to mean no clipping in np.clip has always been unreliable, and is now deprecated. In future, this will always return nan, like it already does when min or max are arrays that contain nan. To skip a bound, pass either None or an np.inf of an appropriate sign.rF   rG   rD   )
ValueErrorrC   r@   floatrK   rL   rP   rU   r=   minimummaximumclip)r   minmaxr   rE   rS   using_deprecated_nanr   r   r   _clip   sN   

r_   c          
      C   sN  t | }d}t||||d}|du r|dkr'nt|dkd dr'tjdtdd |d u rKt|jjt	j
t	jfr<td	}nt|jjt	jrKtd
}d}t||||||d}	t|	tjrt  tj|	||	ddd}	W d    n1 ssw   Y  |r|d u r|j|	}	|	S t|	dr|r|j|	| }	|	S |	j|	| }	|	S |	| }	|	S )NFr   r   Tr   r   zMean of empty slice.rF   rG   f8f4r#   rI   r   rE   subokr   )r   r;   r&   rK   rL   RuntimeWarning
issubclassr   typer5   integerbool_r3   float16r   r1   rA   r   r=   true_dividehasattr)
r   r   r   r   r   r   r8   is_float16_resultrcountretr   r   r   _mean   s:   "

	
rq   c                C   sF  t | }t||||d}|du r||kr%nt||kd dr%tjdtdd |d u r9t|jjt	j
t	jfr9td}t|||d|d}	|jdkrJ|}
n||	j}
t|	tjrtt  tj|	|
|	d	d
d}	W d    n1 snw   Y  nt|	dr|	j|	| }	n|	| }	t ||	 }t|jjt	jt	j
frtj|||d}n3|jtv r|jt|j dfd}tj|||d tj|d |d |jdj}ntj|t||dj}t||||||d}t|| d}t|tjrt  tj|||d	d
d}W d    |S 1 sw   Y  |S t|dr|j|| }|S || }|S )Nr`   Tra   z!Degrees of freedom <= 0 for slicerF   rG   rb   r   rI   Frd   r   r   rF   )r   ).r   ).r,   )r   r;   r&   rK   rL   rf   rg   r   rh   r5   ri   rj   r3   r   r0   reshaper2   r1   rA   r   r=   rl   rm   floatingmultiply_complex_to_floatviewaddreal	conjugaterZ   )r   r   r   r   ddofr   r   r8   ro   arrmeandivxxvrp   r   r   r   _var   s\   "






r   c             	   C   sb   t | ||||||d}t|tjrtj||d}|S t|dr*|jt|}|S t|}|S )N)r   r   r   r|   r   r   rr   r   )	r   r1   r3   rA   r=   sqrtrm   r   rh   )r   r   r   r   r|   r   r   rp   r   r   r   _std  s   

r   c              	   C   s&   t t| |d ||t| |d d ||S r   )r=   subtractr   r   )r   r   r   r   r   r   r   _ptp  s
   r   rF   c                 C   s\   t |dr
t|}ntt|d}|}tj| ||d W d    d S 1 s'w   Y  d S )Nwritewbprotocol)rm   r   openr   r
   dump)selffiler   ctxfr   r   r   _dump   s   

"r   c                 C   s   t j| |dS )Nr   )r
   dumps)r   r   r   r   r   _dumps(  s   r   )NNNF)FT)NNN)NNNr   F)NNFrs   )<__doc__rK   
contextlibr   
numpy.corer   r3   r   r=   numpy.core.multiarrayr   r   r5   r   numpy.core._ufunc_configr   numpy._globalsr	   numpy.compatr
   r   rZ   reducer   rY   r   ry   r   rv   r!   
logical_orr&   logical_andr*   r   csinglesinglecdoubledoublerw   
longdoubleupdateclongdoubler   r   r    r"   r(   r+   r;   r@   rC   rU   r_   rq   r   r   r   r   r   r   r   r   r   <module>   sj    





%"E

