ML idZddlmZddlZddlZddlZddlZddlZddlm Z ddl m Z ddl m Z ddlmZddlmZmZdd lmZmZej,Zej0d ZGd d eZdd ZddZy)aTest cases for running mypy programs using a Python interpreter. Each test case type checks a program then runs it using Python. The output (stdout) of the program is compared to expected output. Type checking uses full builtins and other stubs. Note: Currently Python interpreter paths are hard coded. Note: These test cases are *not* included in the main test suite, as including this suite would slow down the main suite too much. ) annotationsN)TemporaryDirectory)api)PYTHON3_VERSION) test_temp_dir)DataDrivenTestCase DataSuite)assert_string_arrays_equal split_linesz\b_program.py\bc*eZdZddgZeZddZy)PythonEvaluationSuitezpythoneval.testzpythoneval-asyncio.testct|tjj|jj dy)Nz .mypy_cache)test_python_evaluationospathjoin cache_dirname)selftestcases ^/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/mypy/test/testpythoneval.pyrun_casezPythonEvaluationSuite.run_case%s%xdnn6I6I=)YZN)rrreturnNone)__name__ __module__ __qualname__filesrrrrrr r !s  9 :E"$I[rr c 4|jJdgd}t}|jddjt t t tjddj|jtj}|r|jdj}|D]}|jds|jd d}|jd\}} t|t| ftj j"tj j$fkDsy|j'|d |j(zd z} t*j,jt.| } |j| t1| d d 5} |jD]} | j3| d ddd|jd|g}t5j6|\}}}||zj9D]}|jt.t*j:zrB|j|t=t.t*j:zdj?dk|jAt.t*j:zt.dz}|j|j?d|dkDr|jBs|jd|dk(rP|sNtEj6|d| gt.d}|j'tG|jH|jJt+jL| tO|D]o\}}t*j,j:dzt*j,j:z|vsA|jt*j,j:d||<qtQtS||d|jTd|jVdy#1swYBxYw)z~Runs Mypy in a subprocess. If this passes without errors, executes the script again with a given Python version. Nztest was not properly set up)z--show-tracebackz--no-silence-site-packagesz--no-error-summaryz--hide-error-codesz--allow-empty-bodiesz --test-envz--python-version=.z# flags: (.*)$ =_.pywutf8)encodingz --cache-dir=z /z!!! Mypy crashed !!!rz-WignoreT)cwdcapture_outputtypeshedzInvalid output (z, line )),old_cwd python3_pathappendrmapstrrresearchinput MULTILINEgroupsplit startswithintsys version_infomajorminorextendrrrropenwriterrun splitlinesseplenrstripreplaceoutput subprocessr stdoutstderrremove enumerater adapt_outputfileline)rr mypy_cmdline interpretermadditional_flagsflagtargeted_python_versiontargeted_majortargeted_minorprogram program_pathrRsrKouterr returncoderSprocis rrr)s`    'G)GG 'LK+CHHSo5N,O+PQR "DIIhnn$=r||LA771:++-$ D23*.**S/!*<'1H1N1Ns1S.'^)<=$$**$$**A  ,-HMM!E)G77<< w7L % lC& 1!T !A JJ!Bx  !!,yk23 F77<0Cjs&&(/ ??=2661 2 MM$s=266#9:<=DDVL M<<  6 8KLD MM$++f- . /A~hoo  ,-Qv~~ *g .MRV   k$++t{{;<IIlV$44 77;; #bggkk 1T 9 277;;/3F1I4X*:8==/QYQ^Q^P__`(a=!!s &&P  Pcd|jzdz}|jDcgc]}tj||c}Scc}w)zoo FdJNN7D ) FF FsA)rrrr5rr)rrrz list[str])__doc__ __future__rros.pathr6rLr>tempfilermypyr mypy.defaultsrmypy.test.configrmypy.test.datarr mypy.test.helpersr r executabler2compilerer rrQr rrrrsg #   ')*8E~~ RZZ* + [I[EPGr