
    ٔ j                     :   d Z d Zd Z G d de          Ze G d de                      Ze G d de                      Ze G d	 d
e                      Ze G d de                      Ze G d de                      Z	e G d de
                      ZdS )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                 <    t          |           dk    r| d         S | S )N       )len)tups    kC:\Users\Terasoftware\OneDrive\Desktop\faahhh\fyndo\fyndo\venv\Lib\site-packages\numpy/_core/_exceptions.py_unpack_tupler   	   s"    
3xx1} 1v
    c                 V    t          | t                    sJ | j        j        | _        | 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_baser      s+     c9%%%%%<(CLJr	   c                       e Zd ZdZd ZdS )UFuncTypeErrorz% Base class for all ufunc exceptions c                     || _         d S N)ufunc)selfr   s     r   __init__zUFuncTypeError.__init__!   s    


r	   N)r   
__module____qualname____doc__r    r	   r   r   r      s)        //    r	   r   c                   (     e Zd ZdZ fdZd Z xZS )_UFuncNoLoopErrorz* Thrown when a ufunc loop cannot be found c                 r    t                                          |           t          |          | _        d S r   )superr   tupledtypesr   r   r!   	__class__s      r   r   z_UFuncNoLoopError.__init__(   s,    Fmmr	   c           
          d| j         j        dt          | j        d | j         j                           dt          | j        | j         j        d                    S )Nzufunc z6 did not contain a loop with signature matching types z -> )r   r   r   r!   ninr   s    r   __str__z_UFuncNoLoopError.__str__,   sl    BTZ( B B+DK,HIIB BDJNOO <==B B	
r	   r   r   r   r   r   r'   __classcell__r#   s   @r   r   r   %   sM        44$ $ $ $ $
 
 
 
 
 
 
r	   r   c                   (     e Zd ZdZ fdZd Z xZS )_UFuncBinaryResolutionErrorz' Thrown when a binary resolution fails c                     t                                          ||           t          | j                  dk    sJ d S )N   )r   r   r   r!   r"   s      r   r   z$_UFuncBinaryResolutionError.__init__7   s>    '''4;1$$$$$$r	   c                 <     dj         | j        j        g| j        R  S )Nz7ufunc {!r} cannot use operands with types {!r} and {!r})formatr   r   r!   r&   s    r   r'   z#_UFuncBinaryResolutionError.__str__;   s5    E
J
 #'+
 
 
 	
r	   r(   r*   s   @r   r,   r,   4   sM        11% % % % %
 
 
 
 
 
 
r	   r,   c                        e Zd Z fdZ xZS )_UFuncCastingErrorc                 t    t                                          |           || _        || _        || _        d S r   )r   r   castingfrom_to)r   r   r4   r5   r6   r#   s        r   r   z_UFuncCastingError.__init__E   s4    
r	   )r   r   r   r   r)   r*   s   @r   r2   r2   C   s8                r	   r2   c                   (     e Zd ZdZ fdZd Z xZS )_UFuncInputCastingErrorz, Thrown when a ufunc input cannot be casted c                 ^    t                                          ||||           || _        d S r   )r   r   in_ir   r   r4   r5   r6   ir#   s         r   r   z _UFuncInputCastingError.__init__O   s,    333			r	   c           
          | j         j        dk    r
| j         dnd}d| j         j        d| d| j        d| j        d| j        
S )	Nr     Cannot cast ufunc z input from  to  with casting rule )r   r%   r:   r   r5   r6   r4   r   i_strs     r   r'   z_UFuncInputCastingError.__str__S   s    #':>Q#6>49BP!4 P Pu P PzP P!%P P?C|P P	
r	   r(   r*   s   @r   r8   r8   L   sM        66    
 
 
 
 
 
 
r	   r8   c                   (     e Zd ZdZ fdZd Z xZS )_UFuncOutputCastingErrorz- Thrown when a ufunc output cannot be casted c                 ^    t                                          ||||           || _        d S r   )r   r   out_ir;   s         r   r   z!_UFuncOutputCastingError.__init___   s,    333


r	   c           
          | j         j        dk    r
| j         dnd}d| j         j        d| d| j        d| j        d| j        
S )	Nr   r>   r?   r@   z output rA   rB   rC   )r   noutrI   r   r5   r6   r4   rD   s     r   r'   z _UFuncOutputCastingError.__str__c   s    $(JOq$8@4:    bP!4 P P P PzP P!%P P?C|P P	
r	   r(   r*   s   @r   rG   rG   \   sM        77    
 
 
 
 
 
 
r	   rG   c                   J    e Zd ZdZd Zed             Zed             Zd Z	dS )_ArrayMemoryErrorz) Thrown when an array cannot be allocatedc                 "    || _         || _        d S r   )shapedtype)r   rO   rP   s      r   r   z_ArrayMemoryError.__init__o   s    



r	   c                 <    | j         j        }| j        D ]}||z  }|S r   )rP   itemsizerO   )r   	num_bytesdims      r   _total_sizez_ArrayMemoryError._total_sizes   s/    J'	: 	 	CIIr	   c                    d}d}g d}t          |                                 dz
  d          |z  }d||z  z  }| |z  }~t          |          |k    r
|dz  }||z  }|t          |          k    r"t          |          dz
  }|d||z
  |z  z  z  }|}||         }|dk    r|dd| S t          |          dk     r|d	d| S |d
d| S )z5 Convert a number of bytes into a binary size string 
   i   )bytesKiBMiBGiBTiBPiBEiBr   r   z.0fr>   i  z#.3gz#.0f)max
bit_lengthroundr   )	rS   	LOG2_STEPSTEPunitsunit_iunit_valn_units
new_unit_i	unit_names	            r   _size_to_stringz!_ArrayMemoryError._size_to_stringz   s2   
 	CCCY))++a/33y@)+,h& >>T! 	aKFtOG SZZ 	 UaJqfz1Y>??GF&M	Q; 	1///I///7^^d" 	1000Y000 000Y000r	   c                 `    |                      | j                  }d| d| j         d| j         S )NzUnable to allocate z for an array with shape z and data type )rj   rU   rO   rP   )r   size_strs     r   r'   z_ArrayMemoryError.__str__   sL    ''(899;h ; ;:; ;.2j; ; 	<r	   N)
r   r   r   r   r   propertyrU   staticmethodrj   r'   r   r	   r   rM   rM   l   so        33     X "1 "1 \"1H< < < < <r	   rM   N)r   r   r   	TypeErrorr   r   r,   r2   r8   rG   MemoryErrorrM   r   r	   r   <module>rq      s           Y    
 
 
 
 
 
 
 
 
 
 
 
 
"3 
 
 
         
 
 
 
 
0 
 
 
 
 
 
 
 
1 
 
 
 5< 5< 5< 5< 5< 5< 5< 5< 5< 5<r	   