둖FdZddlmZdZdZGddeZeGddeZeGd d eZeGd d eZ eGd de Z eGdde Z eGdde Z dS)z Various richly-typed exceptions, that also help us deal with string formatting in python where it's easier. By putting the formatting in `__str__`, we also avoid paying the cost for users who silence the exceptions. ) set_modulec<t|dkr|dS|S)N)len)tups j/builddir/build/BUILD/cloudlinux-venv-1.0.10/venv/lib64/python3.11/site-packages/numpy/core/_exceptions.py _unpack_tupler s 3xx1}}1v  cVt|tsJ|jj|_|S)aG A decorator that makes an exception class look like its base. We use this to hide subclasses that are implementation details - the user should catch the base type, which is what the traceback will show them. Classes decorated with this decorator are subject to removal without a deprecation warning. ) issubclass Exception__base____name__)clss r _display_as_basers+ c9 % %%% %<(CL Jr ceZdZdZdZdS)UFuncTypeErrorz% Base class for all ufunc exceptions c||_dSN)ufunc)selfrs r __init__zUFuncTypeError.__init__"s  r N)r __module__ __qualname____doc__rr r rr s)//r rc(eZdZdZfdZdZxZS)_UFuncNoLoopErrorz* Thrown when a ufunc loop cannot be found crt|t||_dSr)superrtupledtypesrrr# __class__s r rz_UFuncNoLoopError.__init__)s, Fmm r c d|jjt|jd|jjt|j|jjdS)NzLufunc {!r} did not contain a loop with signature matching types {!r} -> {!r})formatrrr r#ninrs r __str__z_UFuncNoLoopError.__str__-sW  & J  $+otz~o6 7 7 $+djnoo6 7 7   r rrrrrr* __classcell__r%s@r rr&sM44$$$$$       r rc(eZdZdZfdZdZxZS)_UFuncBinaryResolutionErrorz' Thrown when a binary resolution fails ct||t|jdksJdS)Nr)r!rrr#r$s r rz$_UFuncBinaryResolutionError.__init__;s> '''4;1$$$$$$r c<dj|jjg|jRS)Nz7ufunc {!r} cannot use operands with types {!r} and {!r})r'rrr#r)s r r*z#_UFuncBinaryResolutionError.__str__?s5 E  J  #'+    r r+r-s@r r/r/8sM11%%%%%       r r/ceZdZfdZxZS)_UFuncCastingErrorctt|||_||_||_dSr)r!rcastingfrom_to)rrr5r6r7r%s r rz_UFuncCastingError.__init__Is4   r )rrrrr,r-s@r r3r3Gs8r r3c(eZdZdZfdZdZxZS)_UFuncInputCastingErrorz, Thrown when a ufunc input cannot be casted c^t||||||_dSr)r!rin_irrr5r6r7ir%s r rz _UFuncInputCastingError.__init__Ss, 333 r c|jjdkrd|jnd}d|jj||j|j|jS)Nr{} zGCannot cast ufunc {!r} input {}from {!r} to {!r} with casting rule {!r})rr(r'r;rr6r7r5ri_strs r r*z_UFuncInputCastingError.__str__WsW+/:>Q+>+> TY'''B  & J  DGT\   r r+r-s@r r9r9PsM66       r r9c(eZdZdZfdZdZxZS)_UFuncOutputCastingErrorz- Thrown when a ufunc output cannot be casted c^t||||||_dSr)r!rout_ir<s r rz!_UFuncOutputCastingError.__init__es, 333 r c|jjdkrd|jnd}d|jj||j|j|jS)Nrr?r@zHCannot cast ufunc {!r} output {}from {!r} to {!r} with casting rule {!r})rnoutr'rFrr6r7r5rAs r r*z _UFuncOutputCastingError.__str__isW,0JOq,@,@ TZ(((b  & J  DGT\   r r+r-s@r rDrDbsM77       r rDcJeZdZdZdZedZedZdZ dS)_ArrayMemoryErrorz) Thrown when an array cannot be allocatedc"||_||_dSr)shapedtype)rrLrMs r rz_ArrayMemoryError.__init__ws  r c<|jj}|jD]}||z}|Sr)rMitemsizerL)r num_bytesdims r _total_sizez_ArrayMemoryError._total_size{s/J' :  C  IIr cd}d}gd}t|dz d|z}d||zz}||z }~t||kr |dz }||z}|t|kr"t|dz }|d||z |zzz}|}||}|dkrd||St|dkrd||Sd ||S) z5 Convert a number of bytes into a binary size string i)bytesKiBMiBGiBTiBPiBEiBrrz {:.0f} {}iz {:#.3g} {}z {:#.0f} {})max bit_lengthroundrr') rP LOG2_STEPSTEPunitsunit_iunit_valn_units new_unit_i unit_names r _size_to_stringz!_ArrayMemoryError._size_to_strings&  CCCY))++a/33y@)+,h&  >>T ! ! aKF tOG SZZ  UaJ qfz1Y>? ?GF&M Q;;%%gy99 9 7^^d " "&&w :: : &&w :: :r cx||j}d||j|jS)NzAUnable to allocate {} for an array with shape {} and data type {})rgrRr'rLrM)rsize_strs r r*z_ArrayMemoryError.__str__s5''(899 O VHdj$* 5 5 r N) rrrrrpropertyrR staticmethodrgr*rr r rJrJtso33X ";";\";H     r rJN)r_utilsrr r TypeErrorrrr/r3r9rD MemoryErrorrJrr r ros    Y         "      "3          0   "     1   "7 7 7 7 7 7 7 7 7 7 r