Ë
    èÿæit  ã                   ó:  — d dl Z d dlmZ d dlZd dlmZ d dlmZmZ d dlm	Z	m
Z
 d dlZ	 d dlZ	 d dlZ ej                  edu d«       G d„ de
«      «       Z G d	„ d
ej                  «      Zedk(  r ej&                  «        yy# e$ r dZY Œ^w xY w# e$ r dZY Œfw xY w)é    N)ÚStringIO)Útypes)ÚjitÚnjit)Úoverride_configÚTestCasez#please install the 'jinja2' packagec                   ó®   — e Zd Zej                  d„ «       Zej                  d„ «       Zej                  d„ «       Z ej                  e
du d«      d„ «       Zy)ÚTestAnnotationc                 óR  — d„ } t        t        j                  t        j                  f«      |«      }|j                  |j                  d      }|j
                  }t        «       }|j                  |«       |j                  «       }|j                  «        | j                  d|«       y)z4
        Ensures template.html is available
        c                 ó4   — |}t        | «      D ]  }||z  }Œ	 |S ©N©Úrange)ÚnÚaÚsÚis       úq/Volumes/fast/ai/experiments/voice-extract-mac/.venv/lib/python3.12/site-packages/numba/tests/test_annotations.pyÚfooz3TestAnnotation.test_exercise_code_path.<locals>.foo   s#   € ØˆAÜ˜1–X�Ø�Q‘‘ð àˆHó    r   r   N)r   r   Úint32Ú	overloadsÚ
signaturesÚtype_annotationr   Úhtml_annotateÚgetvalueÚcloseÚassertIn)Úselfr   ÚcfuncÚcresÚtaÚbufÚoutputs          r   Útest_exercise_code_pathz&TestAnnotation.test_exercise_code_path   s‚   € ò	ð 1””e—k‘k¤5§;¡;Ð/Ó0°Ó5ˆØ�‰˜u×/Ñ/°Ñ2Ñ3ˆØ×!Ñ!ˆä‹jˆØ
×Ñ˜ÔØ—‘“ˆØ�	‰	ŒØ�‰�e˜VÕ$r   c                 óŽ  ‡— d„ Šˆfd„} t        t        j                  fdd¬«      |«      }|j                  |j                  d      }|j
                  }t        «       }|j                  |«       |j                  «       }|j                  «        | j                  d|«       | j                  d|«       | j                  d|«       y	)
zM
        Ensures that lifted loops are handled correctly in obj mode
        c                 ó   — | S r   © )Úxs    r   ÚbarzDTestAnnotation.test_exercise_code_path_with_lifted_loop.<locals>.bar4   s   € ØˆHr   c                 óz   •— d}t        | «      D ]  }||z   }Œ	 t        | «      D ]  }||z   }Œ	 | r| ‰| «      z
  }|S )Ng        r   )r)   Úhr   Úkr*   s       €r   r   zDTestAnnotation.test_exercise_code_path_with_lifted_loop.<locals>.foo7   sK   ø€ ØˆAÜ˜1–X�Ø˜‘E‘ð ä˜1–X�Ø˜‘E‘ð áØ™˜A›‘J�ØˆHr   T)ÚforceobjÚloopliftr   r*   r   Ú
LiftedLoopN)r   r   Úintpr   r   r   r   r   r   r   r   )r   r   r    r!   r"   r#   r$   r*   s          @r   Ú(test_exercise_code_path_with_lifted_loopz7TestAnnotation.test_exercise_code_path_with_lifted_loop.   s¢   ø€ ò	ô	ð A””U—Z‘Z�M¨D¸4Ô@ÀÓEˆØ�‰˜u×/Ñ/°Ñ2Ñ3ˆà×!Ñ!ˆä‹jˆØ
×Ñ˜ÔØ—‘“ˆØ�	‰	ŒØ�‰�e˜VÔ$Ø�‰�e˜VÔ$Ø�‰�l FÕ+r   c                 óÎ  — t        j                  d¬«      d„ «       }t        j                  dt        j                  «      }t
        j                  f}|j                  |«       |j                  |   }t        «       }|j                  j                  |«       |j                  «       }|j                  «        | j                  |j                  d«      d«       d}| j                  |j                  |j                  |«      «      d«       | j                  t!        t        j"                  ||«      «      d|›d|›�¬	«       t
        j$                  f}|j                  |«       |j                  |   }t        «       }|j                  j                  |«       |j                  «       }|j                  «        | j                  |j                  d«      d
«       | j                  |j                  |j                  |«      «      d«       | j                  |j                  |j                  |«      «      d«       | j                  t!        t        j"                  ||«      «      d
«       y)zW
        Test some format and behavior of the html annotation with lifted loop
        T)r.   c                 óH   — t        «        d}t        | «      D ]  }||z  }Œ	 |S )Nr   )Úobjectr   )r)   Úzr   s      r   Úudtz=TestAnnotation.test_html_output_with_lifted_loop.<locals>.udtT   s(   € äŒHØˆAÜ˜1–X�Ø�Q‘‘ð àˆHr   z<td class="lifted_tag">\s*\s*<details>\s*<summary>\s*<code>\s*[0-9]+:\s*[&nbsp;]+for i in range\(x\):  # this line is tagged\s*zFunction name: udté   z!with signature: {} -&gt; pyobjectz not found in )Úmsgé   N)Únumbar   ÚreÚcompileÚ	MULTILINEr   Úint64r   r   r   r   r   r   ÚassertEqualÚcountÚformatÚlenÚfindallÚfloat64)	r   r7   Úre_lifted_tagÚsig_i64r!   r#   r$   ÚsigfmtÚsig_f64s	            r   Ú!test_html_output_with_lifted_loopz0TestAnnotation.test_html_output_with_lifted_loopO   sâ  € ô
 
�‰˜DÔ	!ñ	ó 
"ð	ô Ÿ
™
ðJô �L‰Lóˆô —;‘;�.ˆØ�‰�GÔØ�}‰}˜WÑ%ˆô ‹jˆØ×Ñ×*Ñ*¨3Ô/Ø—‘“ˆØ�	‰	Œð 	×Ñ˜Ÿ™Ð&:Ó;¸QÔ?à4ˆØ×Ñ˜Ÿ™ f§m¡m°GÓ&<Ó=¸qÔAà×ÑœœRŸZ™Z¨°vÓ>Ó?ÀÚ5BÁFÐKð 	ô 	Mô —=‘=Ð"ˆØ�‰�GÔØ�}‰}˜WÑ%ˆô ‹jˆØ×Ñ×*Ñ*¨3Ô/Ø—‘“ˆØ�	‰	Œð 	×Ñ˜Ÿ™Ð&:Ó;¸QÔ?Ø×Ñ˜Ÿ™ f§m¡m°GÓ&<Ó=¸qÔAØ×Ñ˜Ÿ™ f§m¡m°GÓ&<Ó=¸qÔAà×ÑœœRŸZ™Z¨°vÓ>Ó?ÀÕCr   Nz%please install the 'pygments' packagec                 ó*  — t         j                  d„ «       } |dd«       |j                  d¬«       | j                  t        «      5 }|j                  dd¬«       d d d «       | j                  dt        j                  «      «       y # 1 sw Y   Œ/xY w)	Nc                 ó
   — | |fS r   r(   )r)   Úys     r   r   z-TestAnnotation.test_pretty_print.<locals>.foo�   s   € à�a�4ˆKr   r8   r:   T)Úprettyzshould be None)rN   Úfilez$`file` must be None if `pretty=True`)r;   r   Úinspect_typesÚassertRaisesÚ
ValueErrorr   ÚstrÚ	exception)r   r   Úraisess      r   Útest_pretty_printz TestAnnotation.test_pretty_printŒ   s‡   € ô 
�‰ñ	ó 
ð	ñ 	ˆAˆqŒ	à×Ñ ÐÔ&ð ×ÑœzÔ*¨fØ×Ñ TÐ0@ÐÔA÷ +à�‰Ð<Ü˜&×*Ñ*Ó+õ	-÷ +Ð*ús   ÁB	Â	B)Ú__name__Ú
__module__Ú__qualname__r   Úrun_test_in_subprocessr%   r2   rJ   ÚunittestÚskipIfÚpygmentsrV   r(   r   r   r
   r
      s|   „ ð ×$Ñ$ñ%ó %ð%ð* ×$Ñ$ñ,ó %ð,ð@ ×$Ñ$ñ:Dó %ð:Dðx €X‡_�_�X Ð%Ð'NÓOñ-ó Pñ-r   r
   c                   ó0   — e Zd Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zy)ÚTestTypeAnnotationc                 ól   — t        |«      D ]  \  }}||v sŒ|c S  t        dj                  |«      «      ‚)Nzcan't find {!r})Ú	enumeraterR   rB   )r   ÚlinesÚpatr   Úlns        r   Ú
findpatloczTestTypeAnnotation.findpatloc    s:   € Ü˜uÖ%‰EˆAˆrØ�bŠyØ’ð &ô Ð*×1Ñ1°#Ó6Ó7Ð7r   c                 ót   — t        «       }|j                  |«       |j                  «       j                  «       S r   )r   rP   r   Ú
splitlines)r   ÚfuncÚstrbufs      r   ÚgetlineszTestTypeAnnotation.getlines¦   s-   € Ü“ˆØ×Ñ˜6Ô"Ø�‰Ó ×+Ñ+Ó-Ð-r   c                 ó<  — t         j                  d„ «       } |dd«       | j                  |«      }| j                  |d«      }| j                  |d«      }| j                  |d«      }| j                  |d«      }| j	                  ||«       | j	                  ||«       y )Nc                 ó   — | |z   S r   r(   )ÚappleorangeÚberrycherrys     r   r   z+TestTypeAnnotation.test_delete.<locals>.foo¬   s   € à Ñ,Ð,r   r8   r:   z&appleorange = arg(0, name=appleorange)z&berrycherry = arg(1, name=berrycherry)zdel appleorangezdel berrycherry)r;   r   rj   re   Ú
assertLess)r   r   rb   ÚsaÚsbÚeaÚebs          r   Útest_deletezTestTypeAnnotation.test_delete«   s“   € Ü	�‰ñ	-ó 
ð	-ñ 	ˆAˆqŒ	à—‘˜cÓ"ˆð �_‰_˜UÐ$LÓMˆØ�_‰_˜UÐ$LÓMˆà�_‰_˜UÐ$5Ó6ˆØ�_‰_˜UÐ$5Ó6ˆà�‰˜˜BÔØ�‰˜˜BÕr   c                 óx  — t        d|«      5  t        d„ «       }d} ||«      }| j                  ||«       d d d «       | j                  «      }| j	                  |d«      }| j	                  |d«      }| j	                  |d«      }| j	                  |d«      }	| j	                  |d«      }
||||	|
fS # 1 sw Y   Œ{xY w)	NÚEXTEND_VARIABLE_LIFETIMESc                 ó
   — | }|S r   r(   )r   Úbs     r   r   z/TestTypeAnnotation._lifetimes_impl.<locals>.fooÀ   s   € à�Ø�r   é
   za = arg(0, name=a)zb = azcast(value=b)zdel azdel b)r   r   r@   rj   re   )r   Úextendr   r)   rx   rb   rp   rq   Úcast_retÚdelaÚdelbs              r   Ú_lifetimes_implz"TestTypeAnnotation._lifetimes_impl¾   sÁ   € ÜÐ8¸&ÕAÜñó ðð ˆAÙ�A“ˆAØ×Ñ˜Q Ô"÷ Bð —‘˜cÓ"ˆà�_‰_˜UÐ$8Ó9ˆØ�_‰_˜U GÓ,ˆà—?‘? 5¨/Ó:ˆà�‰˜u gÓ.ˆØ�‰˜u gÓ.ˆà�2�x  tÐ+Ð+÷' BÐAús   �)B0Â0B9c                 óÄ   — | j                  d¬«      \  }}}}}| j                  ||«       | j                  ||«       | j                  ||«       | j                  ||«       y )Nr   ©rz   ©r~   ro   ÚassertGreater©r   rp   rq   r{   r|   r}   s         r   Útest_delete_standard_lifetimesz1TestTypeAnnotation.test_delete_standard_lifetimesÔ   s\   € ð (,×';Ñ';À1Ð';Ó'EÑ$ˆˆB�˜$ à�‰˜˜DÔ!Ø�‰˜˜DÔ!à�‰˜˜hÔ'Ø×Ñ˜4 Õ*r   c                 óÄ   — | j                  d¬«      \  }}}}}| j                  ||«       | j                  ||«       | j                  ||«       | j                  ||«       y )Nr8   r€   r�   rƒ   s         r   Útest_delete_extended_lifetimesz1TestTypeAnnotation.test_delete_extended_lifetimesç   s^   € ð (,×';Ñ';À1Ð';Ó'EÑ$ˆˆB�˜$ à�‰˜˜DÔ!Ø�‰˜˜DÔ!à×Ñ˜4 Ô*Ø×Ñ˜4 Õ*r   N)	rW   rX   rY   re   rj   rt   r~   r„   r†   r(   r   r   r_   r_   ž   s    „ ò8ò.ò
 ò&,ò,+ó&+r   r_   Ú__main__)r<   Úior   r;   Ú
numba.corer   r   r   Únumba.tests.supportr   r   r[   Újinja2ÚImportErrorr]   r\   r
   r_   rW   Úmainr(   r   r   Ú<module>rŽ      s·   ðÛ 	Ý ã Ý ß ß 9Û ðÛðÛð
 €‡��˜4�Ð!FÓGôE-�Xó E-ó HðE-ôPZ+˜×*Ñ*ô Z+ðz ˆzÒØ€H‡M�M…Oð øð_ ò Ø‚Fðûð
 ò Ø‚Hðús"   ªB ¯B ÂBÂBÂBÂB