+
    ei  c            	       s  a  R( t40 t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RI	H
t
 ^ RItR]P                  9   t]'       d
   ]R)9  d   Rt]P                  P                  ]'       * RR7      t ^ RIHt R	t]
'       d   ^ R
IHt ^ RIHt ]P2                  P5                  ]P2                  P7                  ]4      R4      t]P2                  P5                  ]R4      t]P2                  P5                  ]R4      t]P2                  P5                  ]R4      t ]P2                  P5                  ]R4      t!]P2                  P5                  ]R4      t"]P2                  P5                  ]R4      t#]! ]$4      t%] ^ k R R lt&R R lt'R R lt(]PR                  ! RRR7      R R l4       t*R R lt+R*t,R+t-Rt.]P                  P^                  ]P                  P                  ]R R7      ]P                  Pa                  R!]+! ]]4      4      R" R# l4       4       4       t1]P                  P^                  ]P                  P                  ]R R7      ]P                  Pa                  R!]+! ] 4      4      R$ R% l4       4       4       t2]P                  P^                  ]P                  P                  ]R R7      ]P                  Pa                  R!]+! ]4      4      R& R' l4       4       4       t3R#   ] d    Rt ELsi ; i),    N)defaultdict)TYPE_CHECKINGZNPY_RUN_MYPY_IN_TESTSUITETz#`NPY_RUN_MYPY_IN_TESTSUITE` not set)reason)apiF)Iterator)ParameterSetZdataZpassfailZrevealZmisczmypy.iniz.mypy_cachec                s0    V ^8  d   QhR\         R\         /# )   keyreturnstrformat   "E/usr/lib64/python3.14/site-packages/numpy/typing/tests/test_typing.py__annotate__r   4   s     6 63 63 6    c                s    \         P                  P                  V 4      w  r\         P                  P                  WP	                  R^4      ^ ,          4      # )zqSplit at the first occurrence of the ``:`` character.

Windows drive-letters (*e.g.* ``C:``) are ignored herein.
:)ospath
splitdrivejoinsplit)r	   Zdrivetails   &  r   	_key_funcr   4   s=    
 ''$$S)KE77<<zz#q1!455r   c                sR    V ^8  d   QhR\         R\        \        \         3,          /# )r   msgr
   )r   Ztupleintr   r   r   r   r   =   s"     $ $ $sCx $r   c                s    \         P                  P                  V 4      w  rVP                  R^4      w  rp \	        V4      V P                  4       3# )z7Strip the filename and line number from a mypy message.r   )r   r   r   r   r   Zstrip)r   _r   linenos   &   r   _strip_filenamer   =   sA    gg  %GAZZQ'NAsv;		##r   c                sZ    V ^8  d   QhR\         P                  \        ,          R\        /# )r   matchr
   )reZMatchr   r   r   r   r   r   D   s"      bhhsm  r   c                s0    V P                  4       ^,          # )z4`re.sub` helper function for stripping module names.)Zgroups)r    s   &r   
strip_funcr"   D   s    <<>!r   Zmodule)ZscopeZautousec                    V ^8  d   QhRR/# r   r
   N r   r   r   r   r   J   s     *  * $ * r   c                 s   \         P                  P                  \        4      '       dJ   \	        \         P
                  P                  RR4      4      '       d   \        P                  ! \        4       \        P                  ! R4      p \        \        \        \        3 F  p\        P                   ! R\"        R\        V.4      w  r#pV'       d   \$        P&                  ! RV 2R4       M$VR9  d   \$        P&                  ! RV R	V 2R4       R
pRpVP)                  R4       F[  pRV9   d   K  Vf   \+        V4      pWW R2,          pV P-                  V4      f   K;  \.        V,          P1                  V4       R
pRpK]  	  K  	  R# )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
ZNUMPY_TYPING_TEST_CLEAR_CACHETz(\s+)?\^(\~+)?z--config-filez--cache-dirz Unexpected mypy standard error

FzUnexpected mypy exit code: z

 N
znote:>   r    i   )r   r   Zisdir	CACHE_DIRZboolenvironZgetshutilZrmtreer!   ZcompilePASS_DIR
REVEAL_DIRFAIL_DIRMISC_DIRr   ZrunMYPY_INIpytestr   r   r   r    OUTPUT_MYPYappend)Zsplit_pattern	directoryZstdoutZstderrZ	exit_codeZ
str_concatfilenameZis           r   run_mypyr5   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   c                (    V ^8  d   QhR\         RR/# )r   directoriesr
   zIterator[ParameterSet]r   r   r   r   r   r   w   s     	= 	= 	=)A 	=r   c               '   s6  "   V  F  p\         P                  ! V4       Fq  w  r#pV Fe  p\         P                  P                  V4      w  rgVR9  d   K-  \         P                  P	                  W%4      p\
        P                  ! WR7      x  Kg  	  Ks  	  K  	  R# 5i).pyi)ZidN)r8   z.py)r   Zwalkr   splitextr   r0   Zparam)	r7   r3   Zrootr   ZfilesZfnameZshort_fnameZextZfullpaths	   *        r   get_test_casesr:   w   ss      	 ggi0NDU#%77#3#3E#: o-77<<4ll8<<  1 !s   BBz{}:{} - reveal mismatch:

{}zMypy is not installedr   c                r#   r$   r%   r   r   r   r   r      s     8 8t 8r   c                 sn   \         pW9  d   R # \        P                  P                  V 4      p. pW,           FH  p\	        V4      w  rVVP                  R4      P                  4       pVP                  V RV RV 24       KJ  	  V'       d*   \        P                  ! RP                  V4      RR7       R # R # )Nzerror:r   z - r'   FZpytrace)r1   r   r   relpathr   ZremoveprefixZlstripr2   r0   r   r   )r   output_mypyr<   ZmessagesZmessager   Zcontent   &      r   	test_passr?      s    
 Kggood#G H$$)'2&&x07797)1VHCy9: %
 DIIh'7 r   c                r6   r   r   r
   Nr   r   r   r   r   r      s     , ,c ,d ,r   c                s   Rp\         pW9  d   R# \        P                  P                  V 4      p. pW ,           FR  p\	        V4      w  rg\
        P                  ! V\        4      p\        P                  W6V4      pVP                  V4       KT  	  V'       d0   \        P                  V4      p	\        P                  ! V	RR7       R# R# )zSValidate that mypy correctly infers the return-types of
the expressions in `path`.
TNFr;   )r1   r   r   r<   r   textwrapZindent_FAIL_INDENT_FAIL_MSG_REVEALr   r2   	_FAIL_SEPr   r0   r   )
r   Z__tracebackhide__r=   r<   ZfailuresZ
error_liner   Z	error_msgr   Zreasonss
   &         r   test_revealrE      s     Kggood#G H!''
+J7OOI|<	!(()D	 ( ..*GU+ r   c                r6   r@   r   r   r   r   r   r      s     ) ) ) )r   c                sz   \         P                  P                  V 4      w  rV P                  \         P                  4      RR w  r4\
        P                  P                  V RV 2V 4      pVf   Q hVP                  f   Q h\
        P                  P                  V4      pVP                  P                  V4       R# )z9Validate that the code in `path` properly during runtime.NZ.i)r   r   r9   r   Zsep	importlibZutilZspec_from_file_locationZloaderZmodule_from_specZexec_module)r   Zpath_without_extensionr   dirnamer4   ZspecZtest_moduler>   r   test_code_runsrH      s    
 !# 0 0 6

266*23/G>>11)1XJD ;;"""..11$7KKKK(r   c                sx    V ^8  d   Qh/ ^ \         9   d&   \        \        \        \        ,          3,          ;R&   # )r   r1   )__conditional_annotations__r   r   listr   r   r   r   r      s)      ` = <[d3i( <a r   )Z0r&   Zfalsez    zR
_______________________________________________________________________________

)5rI   Zimportlib.utilrF   r   r!   r*   rA   Zcollectionsr   Ztypingr   r0   r)   ZRUN_MYPYZmarkZskipifZ
pytestmarkZmypyr   ZNO_MYPYZImportErrorZcollections.abcr   Z_pytest.mark.structuresr   r   r   rG   Z__file__ZDATA_DIRr+   r-   r,   r.   r/   r(   rJ   r1   r   r   r"   Zfixturer5   r:   rB   rD   rC   ZslowZparametrizer?   rE   rH   r   )rI   s   @r   <module>rK      s     	 	   #   
 '"**4 22H [[L0   
 G( 577<<16:77<<&)77<<&)WW\\(H-
77<<&)77<<*-GGLL=1	 ,7t+< <6$
 h-*  .* Z	= $	 
 G$;<(!CD8 E = 8( G$;<
!;<, = = ,2 G$;<!9:) ; = )M  Gs   .K 	K*)K*