
    -i              	          % S SK rS SKrS SKrS SKrS SKrS SKJr  S SKJ	r	  S SK
r
S\R                  ;   r\(       a  \S;  a  Sr\
R                  R                  \(       + SS9r S S	KJr  S
r\	(       a  S SKJr  S SKJr  \R0                  R3                  \R0                  R5                  \5      S5      r\R0                  R3                  \S5      r\R0                  R3                  \S5      r\R0                  R3                  \S5      r\R0                  R3                  \S5      r \R0                  R3                  \S5      r!\R0                  R3                  \S5      r"\" \#5      r$\\%\#\%   4   \&S'   S\%S\%4S jr'S\%S\(\)\%4   4S jr*S\RV                  \%   S\%4S jr,\
RZ                  " SSS9S*S j5       r.S\%SS 4S! jr/S"r0S#r1S$r2\
R                  Rf                  \
R                  R                  \S%S9\
R                  Ri                  S&\/" \\5      5      S*S' j5       5       5       r5\
R                  Rf                  \
R                  R                  \S%S9\
R                  Ri                  S&\/" \5      5      S&\%SS4S( j5       5       5       r6\
R                  Rf                  \
R                  R                  \S%S9\
R                  Ri                  S&\/" \5      5      S&\%SS4S) j5       5       5       r7g! \ a    Sr GNf = f)+    N)defaultdict)TYPE_CHECKINGNPY_RUN_MYPY_IN_TESTSUITE)0 falseTz#`NPY_RUN_MYPY_IN_TESTSUITE` not set)reason)apiF)Iterator)ParameterSetdatapassfailrevealmisczmypy.iniz.mypy_cacheOUTPUT_MYPYkeyreturnc                     [         R                  R                  U 5      u  p[         R                  R                  XR	                  SS5      S   5      $ )zqSplit 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      Q/var/www/html/venv/lib/python3.13/site-packages/numpy/typing/tests/test_typing.py	_key_funcr    4   s=    
 ''$$S)KE77<<zz#q1!455    msgc                     [         R                  R                  U 5      u  pUR                  SS5      u  pn [	        U5      U R                  5       4$ )z7Strip the filename and line number from a mypy message.r      )r   r   r   r   intstrip)r"   _r   linenos       r   _strip_filenamer)   =   sA    gg  %GAZZQ'NAsv;		##r!   matchc                 (    U R                  5       S   $ )z4`re.sub` helper function for stripping module names.r   )groups)r*   s    r   
strip_funcr-   D   s    <<>!r!   module)scopeautousec                     [         R                  R                  [        5      (       aH  [	        [         R
                  R                  SS5      5      (       a  [        R                  " [        5        [        R                  " S5      n [        [        [        [        4 H  n[        R                   " S["        S[        U/5      u  p#nU(       a  [$        R&                  " SU 3S5        O#US;  a  [$        R&                  " S	U S
U 3S5        SnSnUR)                  S5       HP  nSU;   a  M  Uc  [+        U5      nXW S3-  nU R-                  U5      c  M4  [.        U   R1                  U5        SnSnMR     M     g)zClears 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_mypyrM   I   s9    	i   ?FGGi JJ01M
Hh?	$'GG-
 %!	 KK<VHEuMf$KK5i[VHMuU
#d#A!|$Q<Cr("J""1%1H%,,Z8
 $! @r!   directorieszIterator[ParameterSet]c               '   ,  #    U  H  n[         R                  " U5       Hm  u  p#nU Ha  n[         R                  R                  U5      u  pgUS;  a  M,  [         R                  R	                  X%5      n[
        R                  " XS9v   Mc     Mo     M     g 7f)N)z.pyiz.py)id)r   walkr   splitextr   rC   param)	rN   rF   rootr'   filesfnameshort_fnameextfullpaths	            r   get_test_casesrZ   w   ss      	 ggi0NDU#%77#3#3E#: o-77<<4ll8<<  1 !s   BBz    zR
_______________________________________________________________________________

z{}:{} - reveal mismatch:

{}zMypy is not installedr   c                 V   [         nX;  a  g [        R                  R                  U 5      n/ nX    HH  n[	        U5      u  pVUR                  S5      R                  5       nUR                  U SU SU 35        MJ     U(       a%  [        R                  " SR                  U5      SS9  g g )Nzerror:r   z - r3   Fpytrace)r   r   r   relpathr)   removeprefixlstriprD   rC   r   r   )r   output_mypyr^   messagesmessager(   contents          r   	test_passre      s    
 Kggood#G H$)'2&&x07797)1VHCy9: %
 DIIh'7 r!   c                 z   Sn[         nX;  a  g[        R                  R                  U 5      n/ nX     HR  n[	        U5      u  pg[
        R                  " U[        5      n[        R                  X6U5      nUR                  U5        MT     U(       a+  [        R                  U5      n	[        R                  " U	SS9  gg)zSValidate 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formatrD   	_FAIL_SEPr   rC   r   )
r   __tracebackhide__ra   r^   failures
error_liner(   	error_msgr	   reasonss
             r   test_revealrr      s     Kggood#G H!'
+J7OOI|<	!(()D	 ( ..*GU+ r!   c                 t   [         R                  R                  U 5      u  pU R                  [         R                  5      SS u  p4[
        R                  R                  U SU 3U 5      nUc   eUR                  c   e[
        R                  R                  U5      nUR                  R                  U5        g)z9Validate that the code in `path` properly during runtime.N.)r   r   rR   r   sep	importlibutilspec_from_file_locationloadermodule_from_specexec_module)r   path_without_extensionr'   dirnamerK   spectest_modules          r   test_code_runsr      s    
 !# 0 0 6

266*23/G>>11)1XJD ;;"""..11$7KKKK(r!   )r   N)8importlib.utilrw   r   r;   r9   rg   collectionsr   typingr   rC   r7   RUN_MYPYmarkskipif
pytestmarkmypyr
   NO_MYPYImportErrorcollections.abcr   _pytest.mark.structuresr   r   r   r~   __file__DATA_DIRr=   r?   r>   r@   rB   r5   listr   str__annotations__r    tupler%   r)   Matchr-   fixturerM   rZ   ri   rl   rj   slowparametrizere   rr   r    r!   r   <module>r      s    	 	   #   
 '"**4 22H [[L0   
 G( 577<<16:77<<&)77<<&)WW\\(H-
77<<&)77<<*-GGLL=1	 ,7t+<[d3i( <63 63 6$ $sCx $bhhsm  
 h-*  .* Z	= 	=)A 	= $	 
 G$;<(!CD8 E = 8( G$;<
!;<,c ,d , = = ,2 G$;<!9:) ) ) ; = )M  Gs   $K0 0K<;K<