Ë
    /æj  ã                   óö   — d Z ddlm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y)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        | «      dk(  r| d   S | S )Né   é    )Úlen)Útups    úY/root/repos/pocs/video-evals/.venv/lib/python3.12/site-packages/numpy/core/_exceptions.pyÚ_unpack_tupler
   
   s   € Ü
ˆ3ƒx�1‚}Ø�1‰vˆàˆ
ó    c                 ó`   — 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*   € ô �cœ9Ô%Ð%Ð%Ø—<‘<×(Ñ(€C„LØ€Jr   c                   ó   — e Zd ZdZd„ Zy)ÚUFuncTypeErrorz% Base class for all ufunc exceptions c                 ó   — || _         y ©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                 óD   •— t         ‰| �  |«       t        |«      | _        y r   )Úsuperr   ÚtupleÚdtypes©r   r   r#   Ú	__class__s      €r	   r   z_UFuncNoLoopError.__init__)   s   ø€ Ü‰Ñ˜ÔÜ˜F“mˆ�r   c           	      óø   — dj                  | j                  j                  t        | j                  d | j                  j
                   «      t        | j                  | j                  j
                  d  «      «      S )NzLufunc {!r} did not contain a loop with signature matching types {!r} -> {!r})Úformatr   r   r
   r#   Únin©r   s    r	   Ú__str__z_UFuncNoLoopError.__str__-   sY   € ðç
‰&Ø�J‰J×ÑÜ˜$Ÿ+™+ o t§z¡z§~¡~Ð6Ó7Ü˜$Ÿ+™+ d§j¡j§n¡n oÐ6Ó7ó
ð	
r   ©r   r   r   r   r   r*   Ú__classcell__©r%   s   @r	   r   r   &   s   ø„ á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                 óZ   •— t         ‰| �  ||«       t        | j                  «      dk(  sJ ‚y )Nr   )r!   r   r   r#   r$   s      €r	   r   z$_UFuncBinaryResolutionError.__init__;   s)   ø€ Ü‰Ñ˜ Ô'Ü�4—;‘;Ó 1Ò$Ð$Ñ$r   c                 ód   —  dj                   | j                  j                  g| j                  ¢­Ž S )Nz7ufunc {!r} cannot use operands with types {!r} and {!r})r'   r   r   r#   r)   s    r	   r*   z#_UFuncBinaryResolutionError.__str__?   s4   € ðØEß
‰&Ø�J‰J×Ñð
ð #'§+¡+ò
ð 	
r   r+   r-   s   @r	   r/   r/   8   s   ø„ á1ô%ö
r   r/   c                   ó   ‡ — e Zd Zˆ fd„Zˆ xZS )Ú_UFuncCastingErrorc                 óN   •— t         ‰| �  |«       || _        || _        || _        y r   )r!   r   ÚcastingÚfrom_Úto)r   r   r5   r6   r7   r%   s        €r	   r   z_UFuncCastingError.__init__I   s%   ø€ Ü‰Ñ˜ÔØˆŒØˆŒ
Øˆ�r   )r   r   r   r   r,   r-   s   @r	   r3   r3   G   s   ø„ ÷ð r   r3   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                 ó8   •— t         ‰| �  ||||«       || _        y r   )r!   r   Úin_i©r   r   r5   r6   r7   Úir%   s         €r	   r   z _UFuncInputCastingError.__init__S   s   ø€ Ü‰Ñ˜ ¨°Ô3Øˆ�	r   c                 óü   — | j                   j                  dk7  rdj                  | j                  «      nd}dj                  | j                   j                  || j
                  | j                  | j                  «      S )Nr   ú{} Ú zGCannot cast ufunc {!r} input {}from {!r} to {!r} with casting rule {!r})r   r(   r'   r;   r   r6   r7   r5   ©r   Úi_strs     r	   r*   z_UFuncInputCastingError.__str__W   sZ   € à+/¯:©:¯>©>¸QÒ+>�—‘˜TŸY™YÔ'ÀBˆðç
‰&Ø�J‰J×Ñ ¨¯
©
°D·G±G¸T¿\¹\ó
ð	
r   r+   r-   s   @r	   r9   r9   P   s   ø„ á6ôö
r   r9   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                 ó8   •— t         ‰| �  ||||«       || _        y r   )r!   r   Úout_ir<   s         €r	   r   z!_UFuncOutputCastingError.__init__e   s   ø€ Ü‰Ñ˜ ¨°Ô3Øˆ�
r   c                 óü   — | j                   j                  dk7  rdj                  | j                  «      nd}dj                  | j                   j                  || j
                  | j                  | j                  «      S )Nr   r?   r@   zHCannot cast ufunc {!r} output {}from {!r} to {!r} with casting rule {!r})r   Únoutr'   rF   r   r6   r7   r5   rA   s     r	   r*   z _UFuncOutputCastingError.__str__i   sZ   € à,0¯J©J¯O©O¸qÒ,@�—‘˜TŸZ™ZÔ(Àbˆðç
‰&Ø�J‰J×Ñ ¨¯
©
°D·G±G¸T¿\¹\ó
ð	
r   r+   r-   s   @r	   rD   rD   b   s   ø„ á7ôö
r   rD   c                   ó<   — e Zd ZdZd„ Zed„ «       Zed„ «       Zd„ Z	y)Ú_ArrayMemoryErrorz) Thrown when an array cannot be allocatedc                 ó    — || _         || _        y r   )ÚshapeÚdtype)r   rL   rM   s      r	   r   z_ArrayMemoryError.__init__w   s   € ØˆŒ
Øˆ�
r   c                 ó^   — | j                   j                  }| j                  D ]  }||z  }Œ	 |S r   )rM   ÚitemsizerL   )r   Ú	num_bytesÚdims      r	   Ú_total_sizez_ArrayMemoryError._total_size{   s4   € à—J‘J×'Ñ'ˆ	Ø—:‘:ò 	ˆCØ˜Ñ‰Ið	àÐr   c                 ó’  — d}d}g d¢}t        | j                  «       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j	                  ||«      S t        |«      dk  rdj	                  ||«      S d	j	                  ||«      S )
z5 Convert a number of bytes into a binary size string é
   i   )ÚbytesÚKiBÚMiBÚGiBÚTiBÚPiBÚEiBr   r   z	{:.0f} {}iè  z
{:#.3g} {}z
{:#.0f} {})ÚmaxÚ
bit_lengthÚroundr   r'   )	rP   Ú	LOG2_STEPÚSTEPÚunitsÚunit_iÚunit_valÚn_unitsÚ
new_unit_iÚ	unit_names	            r	   Ú_size_to_stringz!_ArrayMemoryError._size_to_string‚   sþ   € ð
 ˆ	ØˆÚCˆä�Y×)Ñ)Ó+¨aÑ/°Ó3°yÑ@ˆØ˜ )Ñ+Ñ,ˆØ˜hÑ&ˆØô �‹>˜TÒ!Ø�a‰KˆFØ�t‰OˆGð ”S˜“ZÒÜ˜U› a™ˆJØ�q˜f zÑ1°YÑ>Ñ?Ñ?ˆGØˆFà˜&‘Mˆ	à�QŠ;à×%Ñ% g¨yÓ9Ð9Ü�7‹^˜dÒ"à×&Ñ& w°	Ó:Ð:ð  ×&Ñ& w°	Ó:Ð:r   c                 ó†   — | j                  | j                  «      }dj                  || j                  | j                  «      S )NzAUnable to allocate {} for an array with shape {} and data type {})rg   rR   r'   rL   rM   )r   Úsize_strs     r	   r*   z_ArrayMemoryError.__str__§   s6   € Ø×'Ñ'¨×(8Ñ(8Ó9ˆàOß‰V�H˜dŸj™j¨$¯*©*Ó5ð	
r   N)
r   r   r   r   r   ÚpropertyrR   Ústaticmethodrg   r*   r   r   r	   rJ   rJ   t   s8   „ á3òð ñó ðð ñ";ó ð";óH
r   rJ   N)r   Ú_utilsr   r
   r   Ú	TypeErrorr   r   r/   r3   r9   rD   ÚMemoryErrorrJ   r   r   r	   ú<module>ro      sÊ   ðñõ  òòô�Yô ð ô
˜ó 
ó ð
ð" ô
Ð"3ó 
ó ð
ð ô˜ó ó ðð ô
Ð0ó 
ó ð
ð" ô
Ð1ó 
ó ð
ð" ô7
˜ó 7
ó ñ7
r   