Ë
    7Š·j  ã            
       óZ  — U d dl Zd dlZd dlZd dlZd dlZd dlmZ d dlm	Z	 d dl
Z
dej                  v ZeredvrdZe
j                  j                  e d¬«      Z	 d d	lmZ d
Ze	rd dlmZ ej,                  j/                  ej,                  j1                  e«      d«      Zej,                  j/                  ed«      Zej,                  j/                  ed«      Zej,                  j/                  ed«      Zej,                  j/                  ed«      Zej,                  j/                  ed«      Zej,                  j/                  ed«      Z  ee!«      Z"ee#e!e#   f   e$d<   de#de#fd„Z%de#de&e'e#f   fd„Z(dejR                  e#   de#fd„Z* e
jV                  dd¬«      d+d„«       Z,de#de!d   fd „Z-d!Z.d"Z/d#Z0e
j                  jb                  e
j                  j                  ed$¬«      e
j                  je                  d% e-ee«      «      d+d&„«       «       «       Z3e
j                  jb                  e
j                  j                  ed$¬«      e
j                  je                  d% e-e«      «      d%e#ddfd'„«       «       «       Z4e
j                  jk                  d(«      e
j                  jb                  e
j                  j                  ed$¬«      e
j                  jk                  d)«      e
j                  je                  d% e-e«      «      d%e#ddfd*„«       «       «       «       «       Z6y# e$ r dZY �ŒÆw xY w),é    N)Údefaultdict)ÚTYPE_CHECKINGÚNPY_RUN_MYPY_IN_TESTSUITE)Ú0Ú ÚfalseTz#`NPY_RUN_MYPY_IN_TESTSUITE` not set)Úreason)ÚapiF)ÚParameterSetÚdataÚpassÚfailÚrevealÚmisczmypy.iniz.mypy_cacheÚOUTPUT_MYPYÚkeyÚreturnc                 ó¬   — t         j                  j                  | «      \  }}t         j                  j                  ||j	                  dd«      d   «      S )zySplit at the first occurrence of the ``:`` character.

    Windows drive-letters (*e.g.* ``C:``) are ignored herein.
    ú:é   r   )ÚosÚpathÚ
splitdriveÚjoinÚsplit)r   ÚdriveÚtails      úT/root/workspace/.venv/lib/python3.12/site-packages/numpy/typing/tests/test_typing.pyÚ	_key_funcr   2   sA   € ô
 —'‘'×$Ñ$ SÓ)�K€Eˆ4Ü�7‰7�<‰<˜˜tŸz™z¨#¨qÓ1°!Ñ4Ó5Ð5ó    Úmsgc                 ó¨   — t         j                  j                  | «      \  }}|j                  dd«      \  }}} t	        |«      | j                  «       fS )z7Strip the filename and line number from a mypy message.r   é   )r   r   r   r   ÚintÚstrip)r!   Ú_r   Úlinenos       r   Ú_strip_filenamer(   ;   sE   € ä�g‰g× Ñ  Ó%�G€A€tØ—Z‘Z  QÓ'�N€A€vˆsÜˆv‹;˜Ÿ	™	›Ð#Ð#r    Úmatchc                 ó(   — | j                  «       d   S )z4`re.sub` helper function for stripping module names.r   )Úgroups)r)   s    r   Ú
strip_funcr,   B   s   € à�<‰<‹>˜!ÑÐr    Úmodule)ÚscopeÚautousec                  ó¶  — t         j                  j                  t        «      rBt	        t         j
                  j                  dd«      «      rt        j                  t        «       t        j                  d«      } t        t        t        t        fD ]Æ  }t        j                   dt"        dt        |g«      \  }}}|rt%        j&                  d|› �d«       n |dvrt%        j&                  d	|› d
|› �d«       d}d}|j)                  d«      D ]J  }d|v rŒ|€t+        |«      }||› d�z  }| j-                  |«      €Œ/t.        |   j1                  |«       d}d}ŒL ŒÈ y)zøClears the cache and run mypy before running any of the typing tests.

    The mypy results are cached in `OUTPUT_MYPY` for further use.

    The cache refresh can be skipped using

    NUMPY_TYPING_TEST_CLEAR_CACHE=0 pytest numpy/typing/tests
    ÚNUMPY_TYPING_TEST_CLEAR_CACHETz(\s+)?\^(\~+)?z--config-filez--cache-dirz Unexpected mypy standard error

F>   r   r   zUnexpected mypy exit code: z

r   Nú
znote:)r   r   ÚisdirÚ	CACHE_DIRÚboolÚenvironÚgetÚshutilÚrmtreeÚreÚcompileÚPASS_DIRÚ
REVEAL_DIRÚFAIL_DIRÚMISC_DIRr
   ÚrunÚMYPY_INIÚpytestr   r   r   r)   r   Úappend)Úsplit_patternÚ	directoryÚstdoutÚstderrÚ	exit_codeÚ
str_concatÚfilenameÚis           r   Úrun_mypyrL   G   s@  € ô 	�‰�‰”iÔ Ü”—‘—‘Ð ?ÀÓFÔGä�‰”iÔ ä—J‘JÐ0Ó1€MÜ¤
¬H´hÐ?ò  ˆ	ä$'§G¡GØÜØÜØð-
ó %Ñ!ˆ�˜	ñ Ü�K‰KÐ<¸V¸HÐEÀuÕMØ˜fÑ$Ü�K‰KÐ5°i°[ÀÀVÀHÐMÈuÔUàˆ
Ø#ˆØ—‘˜dÓ#ò 
	 ˆAØ˜!‰|ØØÐÜ$ Q›<�à˜Q˜C˜r˜(Ñ"ˆJØ×"Ñ" 1Ó%Ñ1Ü˜HÑ%×,Ñ,¨ZÔ8Ø�
Ø‘ñ
	 ñ! r    Údirectoriesr   c            	      ó<  — g }| D ]”  }t        j                  |«      D ]z  \  }}}|D ]o  }t         j                  j                  |«      \  }}|dvrŒ*t         j                  j	                  ||«      }	|j                  t        j                  |	|¬«      «       Œq Œ| Œ– |S )N)z.pyiz.py)Úid)r   Úwalkr   Úsplitextr   rC   rB   Úparam)
rM   Ú
test_casesrE   Úrootr&   ÚfilesÚfnameÚshort_fnameÚextÚfullpaths
             r   Úget_test_casesrZ   u   s¢   € Ø€JØ ò Jˆ	Ü Ÿg™g iÓ0ò 	J‰NˆD�!�UØò J�Ü#%§7¡7×#3Ñ#3°EÓ#:Ñ �˜SØ˜oÑ-ØäŸ7™7Ÿ<™<¨¨eÓ4�Ø×!Ñ!¤&§,¡,¨x¸KÔ"HÕIñJñ	JðJð Ðr    z    zR
_______________________________________________________________________________

z{}:{} - reveal mismatch:

{}zMypy is not installedr   c                 óN  — t         }| |vry t        j                  j                  | «      }g }||    D ]H  }t	        |«      \  }}|j                  d«      j                  «       }|j                  |› d|› d|› �«       ŒJ |r't        j                  dj                  |«      d¬«       y y )Nzerror:r   z - r2   F©Úpytrace)r   r   r   Úrelpathr(   ÚremoveprefixÚlstriprC   rB   r   r   )r   Úoutput_mypyr^   ÚmessagesÚmessager'   Úcontents          r   Ú	test_passre   ‹   s¦   € ô
 €Kà�;ÑØä�g‰g�o‰o˜dÓ#€Gð €HØ˜tÑ$ò ;ˆÜ)¨'Ó2‰ˆ�Ø×&Ñ& xÓ0×7Ñ7Ó9ˆØ�‰˜7˜) 1 V H¨C°¨yÐ9Õ:ð;ñ
 Ü�‰�D—I‘I˜hÓ'°Ö7ð r    c                 ór  — d}t         }| |vryt        j                  j                  | «      }g }||    D ]R  }t	        |«      \  }}t        j                  |t        «      }t        j                  |||«      }|j                  |«       ŒT |r-t        j                  |«      }	t        j                  |	d¬«       yy)z[Validate that mypy correctly infers the return-types of
    the expressions in `path`.
    TNFr\   )r   r   r   r^   r(   ÚtextwrapÚindentÚ_FAIL_INDENTÚ_FAIL_MSG_REVEALÚformatrC   Ú	_FAIL_SEPr   rB   r   )
r   Ú__tracebackhide__ra   r^   ÚfailuresÚ
error_liner'   Ú	error_msgr	   Úreasonss
             r   Útest_revealrr   ¢   s¬   € ð Ðä€KØ�;ÑØä�g‰g�o‰o˜dÓ#€Gð €HØ! $Ñ'ò  ˆ
Ü+¨JÓ7Ñˆ�	Ü—O‘O I¬|Ó<ˆ	Ü!×(Ñ(¨°&¸)ÓDˆØ�‰˜Õð	 ñ Ü—.‘. Ó*ˆÜ�‰�G UÖ+ð r    zignore::DeprecationWarningz1ignore:numpy.fix is deprecated:DeprecationWarningc                 ót  — t         j                  j                  | «      \  }}| j                  t         j                  «      dd \  }}t
        j                  j                  |› d|› �| «      }|€J ‚|j                  €J ‚t
        j                  j                  |«      }|j                  j                  |«       y)z9Validate that the code in `path` properly during runtime.éþÿÿÿNú.)r   r   rQ   r   ÚsepÚ	importlibÚutilÚspec_from_file_locationÚloaderÚmodule_from_specÚexec_module)r   Úpath_without_extensionr&   ÚdirnamerJ   ÚspecÚtest_modules          r   Útest_code_runsr�   ¾   s¤   € ô !#§¡× 0Ñ 0°Ó 6ÑÐ˜AØŸ
™
¤2§6¡6Ó*¨2¨3Ð/Ñ€GˆXä�>‰>×1Ñ1Øˆ)�1�X�JÐ ó€Dð ÐÐÐØ�;‰;Ð"Ð"Ð"ä—.‘.×1Ñ1°$Ó7€KØ‡K�K×Ñ˜KÕ(r    )r   N)7Úimportlib.utilrw   r   r:   r8   rg   Úcollectionsr   Útypingr   rB   r6   ÚRUN_MYPYÚmarkÚskipifÚ
pytestmarkÚmypyr
   ÚNO_MYPYÚImportErrorÚ_pytest.mark.structuresr   r   r   r~   Ú__file__ÚDATA_DIRr<   r>   r=   r?   rA   r4   Úlistr   ÚstrÚ__annotations__r   Útupler$   r(   ÚMatchr,   ÚfixturerL   rZ   ri   rl   rj   ÚslowÚparametrizere   rr   Úfilterwarningsr�   © r    r   ú<module>r™      s7  ðÜ Û 	Û 	Û Û Ý #Ý  ã ð
 '¨"¯*©*Ð4€Ù�Ð 2Ñ2Ø€Hð �[‰[×ÑØ€LØ0ð  ó €
ðÝð €Gáõ 5à�7‰7�<‰<˜Ÿ™Ÿ™¨Ó1°6Ó:€Ø�7‰7�<‰<˜ &Ó)€Ø�7‰7�<‰<˜ &Ó)€Ø�W‰W�\‰\˜( HÓ-€
Ø�7‰7�<‰<˜ &Ó)€Ø�7‰7�<‰<˜ *Ó-€Ø�G‰G�L‰L˜ =Ó1€	ñ ,7°tÓ+<€ˆ[˜˜d 3™i˜Ñ(Ó <ð6�3ð 6˜3ó 6ð$˜ð $  s¨C x¡ó $ð�b—h‘h˜s‘mð ¨ó ð
 €‡��h¨Ô-ò* ó .ð* ðZ ð ¨¨nÑ)=ó ð €Ø$€	ðÐ ð
 ‡�×ÑØ‡�×Ñ�GÐ$;ÐÓ<Ø‡�×Ñ˜¡°¸(Ó!CÓDò8ó Eó =ó ð8ð( ‡�×ÑØ‡�×Ñ�GÐ$;ÐÓ<Ø‡�×Ñ˜¡°
Ó!;Ó<ð,�cð ,˜dò ,ó =ó =ó ð,ð2 ‡�×ÑÐ8Ó9Ø‡�×ÑØ‡�×Ñ�GÐ$;ÐÓ<Ø‡�×ÑÐOÓPØ‡�×Ñ˜¡°Ó!9Ó:ð)˜ð ) ò )ó ;ó Qó =ó ó :ñ
)øðQ ò ØƒGðús   ÁL ÌL*Ì)L*