4"jaSu UddlmZddlZddlZddlZddlZddlZddlm Z ddl m Z ddl m Z mZddlZddlZddlm ZddlmZmZmZ ddlmZdZn #e$rd ZYnwxYwerdd lmZejej e!d Z"eje"d Z#eje"d Z$eje"dZ%eje"dZ&eje"dZ'eje"dZ(iZ)de*d<dNdZ+dOdZ,dPdZ-ej.j/ej.0edej1dd dQd"Z2dRd%Z3ej.j/ej.0edej.4d&e3e#dQd'Z5ej.j/ej.0edej.4d&e3e$dSd(Z6d)Z7d*Z8dTd1Z9dUd3Z:dUd4Z;e;Zej.j/ej.0edej.4d&e3e%dSd:Z?d;Z@ejAd<ZBdWd>ZCej.j/ej.0edej.4d&e3e#dSd?ZDd@dAdBdCdDdEdFdGdHdIdJdKdL ZEej.j/ej.0eddQdMZFdS)X) annotationsN) defaultdict)Iterator)IO TYPE_CHECKING)_PRECISION_DICT_EXTENDED_PRECISION_LIST_C_INTP)apiFT) ParameterSetdatapassfailrevealmisczmypy.iniz .mypy_cachezdict[str, list[str]] OUTPUT_MYPYkeystrreturnctj|\}}tj||dddS)zySplit at the first occurrence of the ``:`` character. Windows drive-letters (*e.g.* ``C:``) are ignored herein. :r)ospath splitdrivejoinsplit)rdrivetails r/builddir/build/BUILD/cloudlinux-venv-1.0.10/venv/lib64/python3.11/site-packages/numpy/typing/tests/test_typing.py _key_funcr!.sF '$$S))KE4 7<<tzz#q11!4 5 55msgc~tj|\}}|dddS)z'Strip the filename from a mypy message.rr)rrrr)r#_rs r _strip_filenamer'7s4g  %%GAt ::c1  b !!r"match re.Match[str]c6|dS)z4`re.sub` helper function for stripping module names.r)groups)r(s r strip_funcr,=s <<>>! r"zMypy is not installed)reasonmodule)scopeautouseNonectjtrFt tjddrtjtttttfD]}tjdtdt|g\}}}|rt!jd|n|dvrt!jd|d||d d }t'j|d t, }t.d |DdS)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 --config-filez --cache-dirz Unexpected mypy standard error >rrzUnexpected mypy exit code:  * )rc3BK|]\}}||t|fVdSN)list.0kvs r zrun_mypy..es5BBDAqBAtAww<BBBBBBr"N)rrisdir CACHE_DIRboolenvirongetshutilrmtreePASS_DIR REVEAL_DIRFAIL_DIRMISC_DIRr runMYPY_INIpytestrreplace itertoolsgroupbyrr!rupdate) directorystdoutstderr exit_codeiterators r run_mypyrWBsN  i  !  ?FF G G!  i    Hh?CC $'G      - % % !   O KEVEE F F F F f $ $ KMiMMVMM N N NR(($V\\$%7%7YGGGBBHBBBBBBB#CCr"rRIterator[ParameterSet]c#Ktj|D]i\}}}|D]`}tj|\}}|dvr8tj||}t j||VajdS)N)z.pyiz.py)id)rwalkrsplitextrrMparam)rRrootr&filesfname short_fnameextfullpaths r get_test_casesrdhs'),,==a = =E!w//66 Ko%%7<<e44l8 <<<<<<  ===r"rct}||vr9d}|dd||Dz }t|dS)NzUnexpected mypy output r7c34K|]}t|VdSr9)r')r<r>s r r?ztest_success..ys*GG++GGGGGGr")rrAssertionError)r output_mypyr#s r test_successriqsY K {* tyyGG[5FGGGGGGS!!!r"cbd}t|5}|}dddn #1swxYwYtd}t}||vsJ||D]}t |ddd}t jd|}|td|t| d}||xx|dz cc<t|D]\} } | dz}| d sd | vr||vr(||dz } d | vr[| d \} } }||}|}t|| |||t!jd |d||dS)NTcdS)Nr6rlr"r ztest_fail..sr"r7rrz"(?P\d+): (error|note): .+$zUnexpected error line format: lineno#z E:z# E: # E: zUnexpected mypy output at line r4)open readlinesrrr'rrer( ValueErrorintgroup enumerate startswith partitionstrip _test_failrMr)r__tracebackhide__finlineserrorsrh error_liner(rniline target_line expressionr&markerexpected_errors r test_failr}s9 d s                 $ $FK ;    !$' , , $Z0066tQ??B  1    =JjJJKK KU[[**++vZ++++U##4Q OOC  T!!fF&:&: FQJ' [ $/$9$9)$D$D !J6#F^1133N\\^^F tZ H H H H KN&NNfVnNN    s 377z9Extra error at line {} Expression: {} Extra error: {!r} zTError mismatch at line {} Expression: {} Expected error: {!r} Observed error: {!r} rerrorr None | strrnruc|)tt|||||vr*tt||||dSr9)rg _FAIL_MSG1format _FAIL_MSG2)rrrrrns r r{r{sjZ..vz5IIJJJ n $ $Z.. J      % $r"dict[str, str]cddddddddd d d d d d }i}i}|D]V\}}tt|}|jj|jjf}||d|||<W|S)Nc_ubytec_ushortc_uintc_ulong c_ulonglongc_bytec_shortc_intc_long c_longlongc_floatc_double c_longdouble) ubyteushortuintcuint ulonglongbyteshortintcint_longlongsingledouble longdoublectypes.)itemsgetattrnpdtypekinditemsize setdefault)dctretvisitednp_namect_name np_scalarrs r _construct_ctypes_dictrs" $  C( C*,GIIKKDD(GB((** #Y_%=>))#/B/B/BCCG Jr"cdtjD}idddddddd d d d d ddddddddddddddddddd d!d"d#id$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5|d6d7d8d5|d9d7d:d5|d;d7dd5|d?d7d@d5|dAd7dBdC|d6d7dDdC|d9d7dEdC|d;d7dC|d=d7dC|d?d7dC|dAd7dF|dGd7dF|dHd7dF|dId7dF|dJd7dK|dHdL|dHd7dK|dIdL|dId7dK|dJdL|dJd7|d?dMtdN S)ONcti|]5\}}|dd|dd6S).r%numpyz numpy._typing)rrNr;s r z*_construct_format_dict..sK , , , 1a 773<< QYYw@@ , , ,r"uint8z*numpy.unsignedinteger[numpy._typing._8Bit]uint16z+numpy.unsignedinteger[numpy._typing._16Bit]uint32z+numpy.unsignedinteger[numpy._typing._32Bit]uint64z+numpy.unsignedinteger[numpy._typing._64Bit]uint128z,numpy.unsignedinteger[numpy._typing._128Bit]uint256z,numpy.unsignedinteger[numpy._typing._256Bit]int8z(numpy.signedinteger[numpy._typing._8Bit]int16z)numpy.signedinteger[numpy._typing._16Bit]int32z)numpy.signedinteger[numpy._typing._32Bit]int64z)numpy.signedinteger[numpy._typing._64Bit]int128z*numpy.signedinteger[numpy._typing._128Bit]int256z*numpy.signedinteger[numpy._typing._256Bit]float16z$numpy.floating[numpy._typing._16Bit]float32z$numpy.floating[numpy._typing._32Bit]float64z$numpy.floating[numpy._typing._64Bit]float80z$numpy.floating[numpy._typing._80Bit]float96z$numpy.floating[numpy._typing._96Bit]float128z%numpy.floating[numpy._typing._128Bit]float256z%numpy.floating[numpy._typing._256Bit] complex64zAnumpy.complexfloating[numpy._typing._32Bit, numpy._typing._32Bit] complex128zAnumpy.complexfloating[numpy._typing._64Bit, numpy._typing._64Bit] complex160zAnumpy.complexfloating[numpy._typing._80Bit, numpy._typing._80Bit] complex192zAnumpy.complexfloating[numpy._typing._96Bit, numpy._typing._96Bit] complex256zCnumpy.complexfloating[numpy._typing._128Bit, numpy._typing._128Bit] complex512zCnumpy.complexfloating[numpy._typing._256Bit, numpy._typing._256Bit]rznumpy.unsignedinteger[ _NBitByte]r _NBitShortr _NBitIntCuintp _NBitIntPr_NBitIntr _NBitLongLongrznumpy.signedinteger[rrznumpy.floating[ _NBitHalf _NBitSingle _NBitDouble_NBitLongDoubleznumpy.complexfloating[z, r) intprrhalfrrrcsinglecdouble clongdoublerc_intp)rrr )rs r _construct_format_dictrs , ,"(** , , ,C@ =@ ?@  ?@  ? @  A @  A @  :@  <@  <@  <@  >@  >@  9@  9@  9@  9!@ " 9#@ @ $ ;%@ & ;'@ ( E)@ , F-@ 0 F1@ 4 F5@ 8 H9@ < H=@ B =#k*:===C@ D ?3|+<???E@ F =#k*:===G@ H =#k*:===I@ J ;Z;;;K@ L Ec/.BEEEM@ N :s;'7:::O@ P <L(9<<AAADM*DD.1-.@DDDDM*DD.1-.@DDD D%& D D*-.?*@ D D D  O&G%%@ @ @ @r" FORMAT_DICTfileIO[str]&tuple[npt.NDArray[np.str_], list[str]]c|dd}tj|ddj\}}}d|}ttj d|}d|D}|j d i|}||dfS) aExtract and parse all ``" # E: "`` comments from the passed file-like object. All format keys will be substituted for their respective value from `FORMAT_DICT`, *e.g.* ``"{float64}"`` becomes ``"numpy.floating[numpy._typing._64Bit]"``. r5r6r7rp)sepz/nz \{(.*?)\}c Ni|]"}|t|d|d#S)z)rrD)r<r=s r rz"_parse_reveals..FsD  ;??1@!@@@ A Ar"rl) readrNrcharryrTrsetrsfindallr) rstringexpression_arrayr&comments_arraycommentskey_setkwargsfmt_strs r _parse_revealsr3sYY[[ b ) )F+-'*;*; T +<++(ayy((H"*\84455G Fho''''G W]]400 00r"c d}t|5}t|\}}dddn #1swxYwYt}||vsJ||D]}t|}t jd|}|t d|t|ddz }d|vsJ||} ||} t|| | |d|zdS)z[Validate that mypy correctly infers the return-types of the expressions in `path`. TNz(?P\d+): note: .+$Unexpected reveal line format: rnrzRevealed type is) rqrrr'rsr(rtrurv _test_reveal) rr|r}r reveal_listrhrr(rnrrs r test_revealrOsW d 1 1 X  D     ; " " ".11$77KKK(((((r"rrrrrrrrrrrr)  ctjtd}t}||vsJt |5}|}dddn #1swxYwY||D]}|d^}}}}t|}t|} || dz  d} | }|dvsJt| tvrD|dkrtd| tt| } t!|| | || |dkrd} t#|| | || dS) Nzextended_precision.pyirrr7>noterrrzModule has no attribute)rrrrJrrqrrrr'rurstriprzLINENO_MAPPINGr rtrrr{) rrhfexpression_list_msgr&_linenomsg_typr#rnrrs r test_extended_precisionr.s 7<<": ; ;DK ;     d(q++--(((((((((((((((D!BB$(JJsOO!GWcc""W$VaZ077== --//+++++ & !%= = ='!! !K6!K!KLLL$^F%;<T:vsFCCCC'!!24VS&AAA%BBsA##A'*A')rrrr)r#rrr)r(r)rr)rr1)rRrrrX)rrrr1) rrrrrrrrrnrurr1)rr)rrrr) rrrrrrrrrnrurr1)G __future__rimportlib.utilr rOrrsrE collectionsrcollections.abcrtypingrrrMrr numpy.typingnptnumpy.typing.mypy_pluginrr r mypyr NO_MYPY ImportError_pytest.mark.structuresr rrr__file__DATA_DIRrGrIrHrJrLrAr__annotations__r!r'r,markslowskipiffixturerWrd parametrizerirrrr{rrrrQrrrcompilerrrr(r.rlr"r rDs""""""" ######$$$$$$$$$$$$$$  GGGGG 5544444 7<<116 : : 7<<& ) ) 7<<& ) ) W\\(H - - 7<<& ) ) 7<<* - - GLL= 1 1 %' &&&&6666""""  G$;<<h--- C C C.-=< CF====G$;<<!9!9::""";:=<"G$;<<!9!9::&&&;:=<&R       @DDDDR5466 6666 ))++,,,11118G$;<< !;!;<<GGG=<=<G6 ,--    &G$;<<!9!9:: ) ) );:=< )    G$;<<BBB=<BBBs AAA