o 6a**@sdZddlZddlmZddlmZddlmZddl m Z ddlm Z ddlm Z dd lmZdd lmZmZejjZejjZejjZejjZejjZejjZe e j!e e j"e e j#e e j$iZ%e e j&e e j$kre%'e e j(e e j&iddd ed fd dZ)ddd ed fddZ*dddd ed fddZ+dddd ed fddZ,d3d dddZ-d3d dddZ.d4ddZ/ddZ0ddZ1ddd d!d"Z2d5dd#d$d%Z3d3d dd&d'Z4d6d dd(d)Z5d6d dd*d+Z6d7d,d-Z7d8d/d0Z8d8d1d2Z9dS)9zx 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)_NoValue)pickle os_fspathFTcCt||d||||SN) umr_maximumaaxisoutkeepdimsinitialwherer5/usr/lib/python3/dist-packages/numpy/core/_methods.py_amax&rcCr r ) umr_minimumrrrr_amin*rrcCt|||||||Sr )umr_sumrrdtyperrrrrrr_sum.rrcCrr )umr_prodrrrr_prod2rr!rcC,|dur t|||||St||||||dSNTr")umr_anyrrrrrrrrr_any6r'cCr#r$)umr_allr&rrr_all<r(r*cCs|dur0|durtt|j}nt|ts|f}td}|D]}||jt||j9}q|Sddl m }t |||j|tjd|}|S)NTr) broadcast_to) tuplerangendim isinstancentintpshapemunormalize_axis_indexnumpy.lib.stride_tricksr,r)arrrrritemsaxr,rrr_count_reduce_itemsBs   r:cCs>ddlm}||dkrdSzt|WStyYdSw)Nr)r/F)numpy.core.fromnumericr/umisnan TypeError)rr/rrr_clip_dep_is_scalar_nan[s    r?cCst|tjr |jj SdS)NF)r0r4ndarrayrisnative)rrrr_clip_dep_is_byte_swappedes  rBrcastingc Os|dur||||d|Sz ||d|i|WStjyC}ztjd|j|jtdd|||dd|WYd}~Sd}~ww)NrCrzConverting 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. stacklevelunsafe)r_UFuncOutputCastingErrorwarningswarnformatfrom_toDeprecationWarning)ufuncrrDargskwargserrr_clip_dep_invoke_with_castingjs  rT)rDcKs|dur |dur tdt|s5t|s5d}t|r!td }d}t|r+td}d}|r5tjdtdd|durGttj ||f||d|S|durYttj ||f||d|Sttj |||f||d|S) NzOne of max or min must be givenFinfTaPassing `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.rErFrC) ValueErrorrBr?floatrJrKrOrTr<minimummaximumclip)rminmaxrrDrRusing_deprecated_nanrrr_clip}sN   r^c Cs(t|}d}t||||d}|dur|dkr'nt|dkddr'tjdtdd|durKt|jjt j t j frsh             %! A