+
    i'                         R t R tR t ! R R]4      t] ! R R]4      4       t] ! R R]4      4       t] ! R	 R
]4      4       t] ! R R]4      4       t] ! R R]4      4       t	] ! R R]
4      4       tR# )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.
c                 8    \        V 4      ^8X  d
   V ^ ,          # V # )   )len)tups   &9/usr/lib/python3/dist-packages/numpy/_core/_exceptions.py_unpack_tupler   	   s    
3x1}1v
    c                l    \        V \        4      '       g   Q hV P                  P                  V n        V # )a/  
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_baser      s-     c9%%%%<<((CLJr   c                   *   a  ] tR t^t o RtR tRtV tR# )UFuncTypeErrorz$Base class for all ufunc exceptions c                    Wn         R # Nufunc)selfr   s   &&r   __init__UFuncTypeError.__init__!   s    
r   r   N)r   
__module____qualname____firstlineno____doc__r   __static_attributes____classdictcell____classdict__s   @r   r   r      s     / r   r   c                   <   a a ] tR t^%t oRtV 3R ltR tRtVtV ;t	# )_UFuncNoLoopErrorz)Thrown when a ufunc loop cannot be found c                F   < \         SV `  V4       \        V4      V n        R # r   )superr   tupledtypesr   r   r&   	__class__s   &&&r   r   _UFuncNoLoopError.__init__(   s    Fmr   c           
         R V P                   P                  : R\        V P                  RV P                   P                   4      : R\        V P                  V P                   P                  R 4      : 2# )zufunc z6 did not contain a loop with signature matching types Nz -> )r   r   r   r&   ninr   s   &r   __str___UFuncNoLoopError.__str__,   sf    TZZ((+ ,+DKK,HIL MDJJNNO <=@B	
r   )r&   
r   r   r   r   r   r   r-   r   r   __classcell__r(   r    s   @@r   r"   r"   %   s     4$
 
r   r"   c                   <   a a ] tR t^4t oRtV 3R ltR tRtVtV ;t	# )_UFuncBinaryResolutionErrorz&Thrown when a binary resolution fails c                ^   < \         SV `  W4       \        V P                  4      ^8X  g   Q hR# )   N)r$   r   r   r&   r'   s   &&&r   r   $_UFuncBinaryResolutionError.__init__7   s'    '4;;1$$$r   c                f    R P                   ! V P                  P                  .V P                  O5!  # )z7ufunc {!r} cannot use operands with types {!r} and {!r})formatr   r   r&   r,   s   &r   r-   #_UFuncBinaryResolutionError.__str__;   s6    E
& JJ
 #'++
 	
r    r/   r1   s   @@r   r3   r3   4   s     1%
 
r   r3   c                   2   a a ] tR t^Ct oV 3R ltRtVtV ;t# )_UFuncCastingErrorc                J   < \         SV `  V4       W n        W0n        W@n        R # r   )r$   r   castingfrom_to)r   r   r>   r?   r@   r(   s   &&&&&r   r   _UFuncCastingError.__init__E   s    
r   )r>   r?   r@   )r   r   r   r   r   r   r   r0   r1   s   @@r   r<   r<   C   s      r   r<   c                   <   a a ] tR t^Lt oRtV 3R ltR tRtVtV ;t	# )_UFuncInputCastingErrorz+Thrown when a ufunc input cannot be casted c                4   < \         SV `  WW44       WPn        R # r   )r$   r   in_ir   r   r>   r?   r@   ir(   s   &&&&&&r   r    _UFuncInputCastingError.__init__O   s    3	r   c           
         V P                   P                  ^8w  d   V P                   R2MRpRV P                   P                  : RV RV P                  : RV P
                  : RV P                  : 2
# )r     Cannot cast ufunc z input from  to  with casting rule )r   r+   rE   r   r?   r@   r>   r   i_strs   & r   r-   _UFuncInputCastingError.__str__S   sf    #'::>>Q#6499+QB !4!4 7wugUzznD+>t||>NP	
r   )rE   r/   r1   s   @@r   rC   rC   L   s     6
 
r   rC   c                   <   a a ] tR t^\t oRtV 3R ltR tRtVtV ;t	# )_UFuncOutputCastingErrorz,Thrown when a ufunc output cannot be casted c                4   < \         SV `  WW44       WPn        R # r   )r$   r   out_irF   s   &&&&&&r   r   !_UFuncOutputCastingError.__init___   s    3
r   c           
         V P                   P                  ^8w  d   V P                   R2MRpRV P                   P                  : RV RV P                  : RV P
                  : RV P                  : 2
# )r   rJ   rK   rL   z output rM   rN   rO   )r   noutrV   r   r?   r@   r>   rP   s   & r   r-    _UFuncOutputCastingError.__str__c   sg    $(JJOOq$84::,a b !4!4 7xwezznD+>t||>NP	
r   )rV   r/   r1   s   @@r   rT   rT   \   s     7
 
r   rT   c                   P   a  ] tR t^lt o RtR t]R 4       t]R 4       t	R t
RtV tR# )_ArrayMemoryErrorz(Thrown when an array cannot be allocatedc                    Wn         W n        R # r   )shapedtype)r   r^   r_   s   &&&r   r   _ArrayMemoryError.__init__o   s    

r   c                h    V P                   P                  pV P                   F  pW,          pK  	  V# r   )r_   itemsizer^   )r   	num_bytesdims   &  r   _total_size_ArrayMemoryError._total_sizes   s-    JJ''	::CI r   c                   ^
pRp. ROp\        V P                  4       ^,
          ^4      V,          p^WA,          ,          pW,          p?\        V4      V8X  d   V^,          pWb,          pV\        V4      8  d2   \        V4      ^,
          pV^WG,
          V,          ,          ,          pTpW4,          pV^ 8X  d	   VR RV 2# \        V4      R8  d	   VR RV 2# VR RV 2# )z4Convert a number of bytes into a binary size string i   z.0frJ   i  z#.3gz#.0f)bytesKiBMiBGiBTiBPiBEiB)max
bit_lengthroundr   )	rc   	LOG2_STEPSTEPunitsunit_iunit_valn_units
new_unit_i	unit_names	   &        r   _size_to_string!_ArrayMemoryError._size_to_stringz   s    
 	CY))+a/3y@+,& >T!aKFOG SZUaJqf1Y>??GFM	Q;c]!I;//7^d"d^1YK00 d^1YK00r   c                v    V P                  V P                  4      pR V RV P                   RV P                   2# )zUnable to allocate z for an array with shape z and data type )rz   re   r^   r_   )r   size_strs   & r   r-   _ArrayMemoryError.__str__   s?    ''(8(89%hZ/H::,odjj\; 	<r   )r_   r^   N)r   r   r   r   r   r   propertyre   staticmethodrz   r-   r   r   r   s   @r   r\   r\   l   s@     3   "1 "1H< <r   r\   N)r   r   r   	TypeErrorr   r"   r3   r<   rC   rT   MemoryErrorr\   r:   r   r   <module>r      s   Y  
 
 
 
"3 
 
    
0 
 
 
1 
 
 5< 5< 5<r   