
    Kht                        % S SK J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 SKJ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  \R6                  R9                  \R6                  R;                  \5      S5      r\R6                  R9                  \S5      r \R6                  R9                  \S5      r!\R6                  R9                  \S5      r"\R6                  R9                  \S5      r#\R6                  R9                  \S5      r$\R6                  R9                  \S5      r%\" \&5      r'S\(S'   S7S jr)S8S jr*S9S jr+\RX                  " SSS9S:S j5       r-S;S jr.\R                   R^                  \R                   R#                  \SS
9\R                   Ra                  S \." \ 5      5      S:S! j5       5       5       r1\R                   R^                  \R                   R#                  \SS
9\R                   Ra                  S \." \!5      5      S<S" j5       5       5       r2S#r3S$r4            S=S% jr5S&r6\R                   R^                  \R                   R#                  \SS
9\R                   Ra                  S \." \"5      5      S<S' j5       5       5       r7\R                   R^                  \R                   R#                  \SS
9\R                   Ra                  S \." \ 5      5      S<S( j5       5       5       r8S)S*S+S,S-S.S/S0S1S2S3S4S5.r9\R                   R^                  \R                   R#                  \SS
9S:S6 j5       5       r:g! \ a    Sr GNf = f)>    )annotationsN)defaultdict)TYPE_CHECKING)_EXTENDED_PRECISION_LIST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_cachezdefaultdict[str, list[str]]OUTPUT_MYPYc                    [         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)keydrivetails      P/var/www/html/env/lib/python3.13/site-packages/numpy/typing/tests/test_typing.py	_key_funcr!   6   s=    
 ''$$S)KE77<<zz#q1!455    c                    [         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)msg_r   linenos       r    _strip_filenamer*   ?   sA    gg  %GAZZQ'NAsv;		##r"   c                (    U R                  5       S   $ )z4`re.sub` helper function for stripping module names.r   )groups)matchs    r    
strip_funcr.   F   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5        O"US;  a  [$        R&                  " SU S	U 3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

>   r   r   zUnexpected mypy exit code: 

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_mypyrO   K   s5    	i   ?FGGi JJ01M
Hh?	$'GG-
 %!	 KK<VHEFf$KK5i[VHMN
#d#A!|$Q<Cr("J""1%1H%,,Z8
 $! @r"   c              #    #    [         R                  " U 5       Hm  u  pnU Ha  n[         R                  R                  U5      u  pVUS;   d  M,  [         R                  R	                  X5      n[
        R                  " XuS9v   Mc     Mo     g 7f)N)z.pyiz.py)id)r   walkr   splitextr   rE   param)rH   rootr(   filesfnameshort_fnameextfullpaths           r    get_test_casesr[   y   sf     ''),E!ww//6Ko%77<<4ll8<<	  -s   AB>BzMypy is not installedr   c                n    [         nX;   a*  SnUSR                  S X    5       5      -  n[        U5      eg )NzUnexpected mypy output

r5   c              3  >   #    U  H  n[        U5      S    v   M     g7f)r   N)r*   ).0vs     r    	<genexpr>test_success.<locals>.<genexpr>   s     J8I1+A.8Is   )r   r   AssertionError)r   output_mypyr'   s      r    test_successrd      s@    
 K*tyyJ8IJJJS!! r"   c                J   Sn[        U 5       nUR                  5       nS S S 5        [        S 5      n[        nX;   d   eXP    H  n[	        U5      u  pvXG==   U S3-  ss'   M!     [        W5       H  u  pUS-   nU	R                  S5      (       d  SU	;  a  Xt;  a  M-  X7S-
     n
SU
;   aE  U
R                  S5      u  pnXG   R                  5       nUR                  5       n[        XXU5        M  [        R                  " S	U S
XG    35        M     g ! , (       d  f       N= f)NTc                     g)Nr	    rg   r"   r    <lambda>test_fail.<locals>.<lambda>   s    r"   r5   r   #z E:z# E:z  # E: zUnexpected mypy output at line r4   )open	readlinesr   r   r*   	enumerate
startswith	partitionr&   
_test_failrE   r   )r   __tracebackhide__finlineserrorsrc   
error_liner)   rN   linetarget_line
expressionr(   markererrorexpected_errors                   r    	test_failr|      s    	ds 
 $FK!'
,Z8ZL++ ( U#QOOC  T!f&:QJ'[ $/$9$9)$D!J6N((*E#\\^NtGKK1&fn=MN $ 
s   D
D"z9Extra error at line {}

Expression: {}
Extra error: {!r}
zRError mismatch at line {}

Expression: {}
Expected error: {}
Observed error: {!r}
c                    Uc  [        [        R                  XAU5      5      eX2;  a  [        [        R                  XAX25      5      eg )N)rb   
_FAIL_MSG1format
_FAIL_MSG2)r   rx   rz   r{   r)   s        r    rp   rp      sL     Z..v5IJJ		$Z..
  	 
%r"   zReveal mismatch at line {}

{}
c                    Sn[         nX;  a  gX     H,  n[        U5      u  pC[        [        R	                  XC5      5      e   g)zSValidate that mypy correctly infers the return-types of
the expressions in `path`.
TN)r   r*   rb   _REVEAL_MSGr   )r   rq   rc   ru   r)   s        r    test_revealr      sH     K!'
,Z8[//CDD (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   rS   r   sep	importlibutilspec_from_file_locationloadermodule_from_specexec_module)r   path_without_extensionr(   dirnamerM   spectest_modules          r    test_code_runsr      s    
 !# 0 0 6

266*23/G>>11)1XJD ;;"""..11$7KKKK(r"   uint128uint256int128int256float80float96float128float256
complex160
complex192
complex256
complex512)                                    c                    [         R                  R                  [        S5      n [        nX;   d   e[        U 5       nUR                  5       nS S S 5        X    Hl  n[        U5      u  pVWUS-
     R                  S5      n[        U   [        ;   a  [        [        R                  XV5      5      eSU;  d  M^  [        XUSU5        Mn     g ! , (       d  f       N= f)Nzextended_precision.pyir   r5   rz   zExpression is of type "Any")r   r   r   rB   r   rk   rl   r*   rstripLINENO_MAPPINGr   rb   r   r   rp   )r   rc   fexpression_list_msgr)   r'   rx   s           r    test_extended_precisionr     s     77<<":;DK	dq++- 
 !%d+$VaZ077=
&!%== !3!3F!@AAC#'Df " 
s   C
C)r   strreturnr   )r'   r   r   ztuple[int, str])r-   zre.Match[str]r   r   )r   None)rH   r   r   zIterator[ParameterSet])r   r   r   r   )r   r   rx   r   rz   r   r{   z
None | strr)   r%   r   r   );
__future__r   importlib.utilr   r   r=   r;   collectionsr   typingr   rE   numpy.typing.mypy_pluginr   r9   RUN_MYPYmarkskipif
pytestmarkmypyr   NO_MYPYImportErrorcollections.abcr   _pytest.mark.structuresr   r   r   r   __file__DATA_DIRr?   rA   r@   rB   rD   r7   listr   __annotations__r!   r*   r.   fixturerO   r[   slowparametrizerd   r|   r~   r   rp   r   r   r   r   r   rg   r"   r    <module>r      s   "  	 	  #    = '"**4 22H [[L0   
 G( 577<<16:77<<&)77<<&)WW\\(H-
77<<&)77<<*-GGLL=1	 ,7t+<( <6$
 h-*  .* Z= G$;<!9:" ; = " G$;<!9:  ; =  F


  	
  
 G$;<
!;<E = = E G$;<!9:) ; = )  	  G$;< = _  Gs   ,N   NN