grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026o ®û|j-rã@sô ddgZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl m ZddlZdZGdd„dƒZdd „Zd d „ZGd d„dƒZd d„Zdd„Zddd„Zdd„ZGdd„dƒZdd„ZedkrxeƒdSdS)ÚTraceÚCoverageResultséN)Ú monotonicz#pragma NO COVERc@seZdZddd„Zdd„ZdS)Ú_IgnoreNcCs:|stƒnt|ƒ|_|sgndd„|Dƒ|_ddi|_dS)NcSsg|]}tj |¡‘qS©)ÚosÚpathÚnormpath©Ú.0Údrrú,/opt/alt/python310/lib64/python3.10/trace.pyÚ Hsÿz$_Ignore.__init__..zé)ÚsetÚ_modsÚ_dirsÚ_ignore)ÚselfÚmodulesÚdirsrrr Ú__init__Fs ÿz_Ignore.__init__cCs¦||jvr |j|S||jvrd|j|<dS|jD]}| |d¡r*d|j|<dSq|dur6d|j|<dS|jD]}| |tj¡rKd|j|<dSq9d|j|<dS)NrÚ.r)rrÚ startswithrrÚsep)rÚfilenameÚ modulenameÚmodr rrr ÚnamesLs(      þ   þ z _Ignore.names©NN)Ú__name__Ú __module__Ú __qualname__rrrrrr rEs  rcCs" tj |¡}tj |¡\}}|S©N)rrÚbasenameÚsplitext)rÚbaserÚextrrr Ú_modnamews r(cCsÄ tj |¡}d}tjD] }tj |¡}| |¡r,|t|ƒtjkr,t|ƒt|ƒkr,|}q |r:|t|ƒdd…}n|}tj |¡\}}| tjd¡}tj rU| tj d¡}tj  |¡\}}|  d¡S)NÚrr) rrÚnormcaseÚsysrÚlenrÚ splitdriveÚreplaceÚaltsepr%Úlstrip)rZ comparepathZlongestÚdirr&Zdriverr'rrr Ú _fullmodname~s$   € r2c@s>eZdZ  ddd„Zdd„Zdd„Zdd d „Zdd d „ZdS)rNc Cs||_|jdur i|_|j ¡|_||_|jduri|_|j ¡|_||_|jdur-i|_|j ¡|_||_||_|jr‹z,t|jdƒ�}t  |¡\}}}Wdƒn1sVwY|  |j |||d�¡WdSt t tfyŠ}ztd|j|ftjd�WYd}~dSd}~wwdS)NÚrb)ÚcallerszSkipping counts file %r: %s©Úfile)ÚcountsÚcopyZcounterÚ calledfuncsr4ÚinfileÚoutfileÚopenÚpickleÚloadÚupdateÚ __class__ÚOSErrorÚEOFErrorÚ ValueErrorÚprintr+Ústderr)rr7r9r:r4r;ÚfÚerrrrr r›s:      ÿÿÿ€ÿúzCoverageResults.__init__cCs | d¡o | d¡S)Nú<ú>)rÚendswith)rrrrr Úis_ignored_filenameµsz#CoverageResults.is_ignored_filenamec Csp |j}|j}|j}|j}|j}|j}|D]}| |d¡||||<q|D]}d||<q&|D]}d||<q/dS©Nrr)r7r9r4Úget) rÚotherr7r9r4Z other_countsZother_calledfuncsZ other_callersÚkeyrrr r?»s  ÿzCoverageResults.updateTFc" Cs |jr!tƒtdƒ|j}t|ƒD]\}}}td|||fƒq|jritƒtdƒd}} t|jƒD]4\\} } } \} }}| |krOtƒtd| dƒ| }d} | | kr^| | kr^td| ƒ| } td| | ||fƒq4i}|jD]\}}| |i¡}||<|j||f||<qni}| ¡D]Ž\}}| |¡r–qŒ| d¡r¡|dd …}|dur´t j   t j   |¡¡}t |ƒ}n|}t j  |¡sÁt  |¡t|ƒ}|rÌt|ƒ}ni}t |¡}t j  ||d ¡}t|d ƒ�}t |j¡\}}Wdƒn1sôwY| |||||¡\}}|�r|�rtd ||ƒ}||||f||<qŒ|�r=|�r=td ƒt|ƒD]}||\}}}}td||ƒ�q)|j�rˆz)t|jdƒ�} t |j|j|jf| d¡WdƒWdS1�scwYWdSt�y‡}!ztd|!tj d�WYd}!~!dSd}!~!wwdS)Nzfunctions called:z*filename: %s, modulename: %s, funcname: %szcalling relationships:r)z***z -->z %s.%s -> %s.%sz.pycéÿÿÿÿz.coverr3édzlines cov% module (path)z%5d %3d%% %s (%s)Úwbrz"Can't save counts files because %sr5)!r9rDÚsortedr4r7rMÚitemsrKrJrrÚdirnameÚabspathr(ÚexistsÚmakedirsr2Ú_find_executable_linenosÚ linecacheÚgetlinesÚjoinr<ÚtokenizeÚdetect_encodingÚreadlineÚwrite_results_fileÚintr;r=ÚdumprAr+rE)"rZ show_missingÚsummaryÚcoverdirZcallsrrÚfuncnameZlastfileZ lastcfileZpfileZpmodZpfuncÚcfileZcmodZcfuncZper_fileÚlinenoÚ lines_hitZsumsÚcountr1ÚlnotabÚsourceZ coverpathÚfpÚencodingÚ_Ún_hitsÚn_linesZpercentÚmrFrGrrr Ú write_resultsÍs’ ÿÿ           ÿÿ €  ÿ(ÿ €ÿúzCoverageResults.write_resultsc Cs  z t|d|d�}Wnty(}ztd||ftjd�WYd}~dSd}~wwd}d} |�Jt|dƒD]9\} } | |vrO| d|| ¡| d7} |d7}n| |vrat| vra| d ¡|d7}n| d ¡| |  d ¡¡q5Wdƒ| |fS1s|wY| |fS) NÚw©rmz3trace: Could not open %r for writing: %s - skippingr5)rrrrz%5d: z>>>>>> z é) r<rArDr+rEÚ enumerateÚwriteÚPRAGMA_NOCOVERÚ expandtabs) rrÚlinesrjrhrmr;rGrprorgÚlinerrr r`)s<ÿÿ€ý    ò ÿïz"CoverageResults.write_results_file)NNNNN)TFNr#)r r!r"rrKr?rrr`rrrr ršs ÿ \cCs. i}t |¡D] \}}||vrd||<q|S)Nr)ÚdisZfindlinestarts)ÚcodeÚstrsÚlinenosrnrgrrr Ú_find_lines_from_codeIs€r€cCs6 t||ƒ}|jD]}t |¡r| t||ƒ¡q |Sr#)r€Ú co_constsÚinspectZiscoder?Ú _find_lines)r}r~rÚcrrr rƒSs   €rƒcCs¢ i}tj}t||d��;}t |j¡}|D])\}}}} } |tjkr<|tjkr<|\} } | \} }t| | dƒD]}d||<q5|}qWdƒ|S1sJwY|S)Nrtr)ÚtokenÚINDENTr<r]Úgenerate_tokensr_ÚSTRINGÚrange)rrmr Z prev_ttyperFÚtokZttypeZtstrÚstartÚendr{ZslineZscolZelineZecolÚirrr Ú _find_strings_s$    ù þ ö rŽc Csž zt |¡�}| ¡}|j}Wdƒn1swYWnty>}ztd||ftjd�iWYd}~Sd}~wwt||dƒ}t ||ƒ}t ||ƒS)Nz%Not printing coverage data for %r: %sr5Úexec) r]r<ÚreadrmrArDr+rEÚcompilerŽrƒ)rrFÚprogrmrGr}r~rrr rYvs& þ€ÿÿ€ý   rYc@sveZdZ   ddd„Zdd „Zdd d „Zd d „Zdd„Zdd„Zdd„Z dd„Z dd„Z dd„Z dd„Z dd„ZdS) rrrrNFc CsÌ ||_||_t||ƒ|_i|_i|_d|_||_i|_i|_ i|_ d|_ | r+t ƒ|_ |r3|j |_dS|r;|j|_dS|rI|rI|j|_|j|_dS|rU|j|_|j|_dS|ra|j|_|j|_dSd|_dSrL)r:r;rÚignorer7ZpathtobasenameÚ donothingÚtraceÚ _calledfuncsÚ_callersÚ _caller_cacheÚ start_timeÚ_timeÚglobaltrace_trackcallersÚ globaltraceÚglobaltrace_countfuncsÚglobaltrace_ltÚlocaltrace_trace_and_countÚ localtraceÚlocaltrace_traceÚlocaltrace_count) rrir•Ú countfuncsÚ countcallersÚ ignoremodsÚ ignoredirsr:r;Útimingrrr r…s8       zTrace.__init__cCs ddl}|j}| |||¡dS)Nr)Ú__main__Ú__dict__Úrunctx)rÚcmdr¨Údictrrr Úrun·sz Trace.runc Cs†|duri}|dur i}|jst |j¡t |j¡zt|||ƒW|js2t d¡t d¡dSdS|jsBt d¡t d¡wwr#)r”Ú threadingÚsettracerœr+r�)rr«ÚglobalsÚlocalsrrr rª¼s      þ  þz Trace.runctxc OsPd}|js t |j¡z||i|¤Ž}W|jst d¡|S|js't d¡wwr#)r”r+r¯rœ)rÚfuncÚargsÚkwÚresultrrr ÚrunfuncÉs  þ ÿz Trace.runfuncc Csð|j}|j}|r t|ƒ}nd}|j}d}||jvr&|j|dur%|j|}nCd|j|<dd„t |¡Dƒ}t|ƒdkridd„t |d¡Dƒ}t|ƒdkridd„t |d¡Dƒ} t| ƒdkri| dj}||j|<|dursd||f}|||fS)NcSsg|] }t |¡r|‘qSr)r‚Z isfunction)r rFrrr råó ÿz1Trace.file_module_function_of..rcSsg|] }t|tƒr|‘qSr)Ú isinstancer¬r rrr rër·rcSsg|] }t|dƒr|‘qS)Ú __bases__)Úhasattr)r r„rrr rîr·z%s.%s) Úf_codeÚ co_filenamer(Úco_namer˜ÚgcZ get_referrersr,r ) rÚframer}rrreZclsnameZfuncsZdictsZclassesrrr Úfile_module_function_ofÔs.   €        zTrace.file_module_function_ofcCs6 |dkr| |¡}| |j¡}d|j||f<dSdS©NÚcallr)rÀÚf_backr—)rr¿ÚwhyÚargÚ this_funcZ parent_funcrrr r›ýs   üzTrace.globaltrace_trackcallerscCs& |dkr| |¡}d|j|<dSdSrÁ)rÀr–)rr¿rÄrÅrÆrrr r�s  þzTrace.globaltrace_countfuncscCsr |dkr7|j}|j dd¡}|r5t|ƒ}|dur1|j ||¡}|s3|jr.td||jfƒ|j SdSdSdSdS)NrÂÚ__file__z! --- modulename: %s, funcname: %s) r»Ú f_globalsrMr(r“rr•rDr½r )rr¿rÄrÅr}rrZ ignore_itrrr ržs$ÿúñzTrace.globaltrace_ltcCs„|dkr?|jj}|j}||f}|j |d¡d|j|<|jr*tdtƒ|jdd�tj   |¡}td||t   ||¡fdd�|j S) Nr{rrú%.2fú ©rŒú %s(%d): %sr))r»r¼Úf_linenor7rMr™rDršrrr$rZÚgetliner )rr¿rÄrÅrrgrOÚbnamerrr rŸ(s  ÿÿz Trace.localtrace_trace_and_countcCsd|dkr/|jj}|j}|jrtdtƒ|jdd�tj |¡}td||t   ||¡fdd�|j S)Nr{rÉrÊrËrÌr)) r»r¼rÍr™rDršrrr$rZrÎr )rr¿rÄrÅrrgrÏrrr r¡7s  ÿÿzTrace.localtrace_tracecCs<|dkr|jj}|j}||f}|j |d¡d|j|<|jS)Nr{rr)r»r¼rÍr7rMr )rr¿rÄrÅrrgrOrrr r¢Ds zTrace.localtrace_countcCst|j|j|j|j|jd�S)N)r:r;r9r4)rr7r:r;r–r—)rrrr ÚresultsLs ýz Trace.results) rrrrrrNNFr)r r!r"rr­rªr¶rÀr›r�ržrŸr¡r¢rÐrrrr r„s  þ2   )   c sìddl}| ¡}|jdddd�| dd¡}|jdd d d d �|jd dd dd �|jddd dd �|jddd dd �| d¡}| ¡}|jddd dd �|jddd dd �|jdddd �|jd!d"d#d �|jd$d%d d&d �|jd'd(d d)d �|jd*d+d d,d �| d-d.¡}|jd/d0gd1d2�|jd3d0gd4d2�|jd5d d6d7d2�|jd8d9d:d;�|jd<|jd=d;�| ¡}|jrÃt  d>¡‰t  d?¡‰‡‡fd@dA„‰dBdC„|j Dƒ|_ ‡fdDdC„|jDƒ|_|j rû|j sé|  dE¡t|j |j dF�}| |j|j|j¡St|j|j|j|jgƒ�s |  dG¡|j�r|j�s|j�r|  dH¡|j�r+|j�s+|  dI¡|jdu�r6|  dJ¡t|j|j|j|j|j |j|j |j |jdK� }zk|j�ruddl}|j}| |¡\} } } | jg|j¢t _!dL| j| j"| j#| ddMœ} n:|jg|j¢t _!t$j% &|j¡t j%d<t' (|j¡�} t)|  *¡|jdNƒ} Wdƒn 1�s¢wY|jdLdddOœ} | +| | | ¡Wn(t,�yÖ}zt  -dPt j!d|f¡WYd}~nd}~wt.�yßYnw| /¡}|j0�sô| |j|j|j¡dSdS)QNrz --versionÚversionz trace 2.0)ÚactionrÑz Main optionsz(One of these (or --report) must be givenz-cz--countÚ store_truez»Count the number of times each line is executed and write the counts to .cover for each module executed, in the module's directory. See also --coverdir, --file, --no-report below.)rÒÚhelpz-tz--tracez3Print each line to sys.stdout before it is executedz-lz --listfuncsz§Keep track of which functions are executed at least once and write the results to sys.stdout after the program exits. Cannot be specified alongside --trace or --count.z-Tz --trackcallsz^Keep track of caller/called pairs and write the results to sys.stdout after the program exits.Z Modifiersz-rz--reportz¶Generate a report from a counts file; does not execute any code. --file must specify the results file to read, which must have been created in a previous run with --count --file=FILEz-Rz --no-reportz^Do not generate the coverage report files. Useful if you want to accumulate over several runs.z-fz--filez+File to accumulate counts over several runs)rÔz-Cz --coverdirz†Directory where the report files go. The coverage report for . will be written to file //.coverz-mz --missingz?Annotate executable lines that were not executed with ">>>>>> "z-sz --summaryz\Write a brief summary for each file to sys.stdout. Can only be used with --count or --reportz-gz--timingzQPrefix each line with the time since the program started. Only used while tracingZFilterszCan be specified multiple timesz--ignore-moduleÚappendzqIgnore the given module(s) and its submodules (if it is a package). Accepts comma separated list of module names.)rÒÚdefaultrÔz --ignore-dirzWIgnore files in the given directory (multiple directories can be joined by os.pathsep).z--moduleFzTrace a module. Úprognameú?zfile to run as main program)ÚnargsrÔÚ argumentszarguments to the programZstdlibZ platstdlibcs4tj tj |¡¡}| dˆ¡ dˆ¡}tj |¡S)Nz$prefixz $exec_prefix)rrÚ expanduserÚ expandvarsr.r )Ús)Ú _exec_prefixÚ_prefixrr Úparse_ignore_dir�s zmain..parse_ignore_dircSs$g|]}| d¡D]}| ¡‘q qS)ú,)ÚsplitÚstrip)r r�rrrr r¢s  ÿÿzmain..cs&g|]}| tj¡D]}ˆ|ƒ‘q qSr)rârÚpathsep)r r�rÝ)ràrr r¤s  ÿÿz-r/--report requires -f/--file)r:r;zLmust specify one of --trace, --count, --report, --listfuncs, or --trackcallsz8cannot specify both --listfuncs and (--trace or --count)z3--summary can only be used with --count or --reportz3progname is missing: required with the main options)r£r¤r¥r¦r:r;r§r¨)r rÇÚ __package__Ú __loader__Ú__spec__Ú __cached__r�)rÇr rårèzCannot run file %r because: %s)1ÚargparseÚArgumentParserÚ add_argumentZadd_argument_groupZadd_mutually_exclusive_groupZ REMAINDERÚ parse_argsZ ignore_dirÚ sysconfigZget_pathZ ignore_moduleZreportr6ÚerrorrrrZmissingrcrdÚanyr•riZ listfuncsZ trackcallsr×rr§ÚmoduleÚrunpyZ_get_module_detailsr¼rÚr+ÚargvÚparentÚloaderrrrUÚioÚ open_coder‘r�rªrAÚexitÚ SystemExitrÐZ no_report)réÚparserZgrpZ_grpZoptsrÐÚtrñZ module_nameZmod_nameZmod_specr}ZglobsrlrGr)rÞrßràr ÚmainRsôÿ ÿ ÿ ÿ ÿ  ÿ ÿÿÿ ÿ ÿ ÿÿ ÿ ÿ ÿÿ ÿ  ÿ ÿ      ýú ÿü$€ÿÿrûr¨r#)Ú__all__rõrZrr+rír…r]r‚r¾r|r=Útimerršr®rxrr(r2rr€rƒrŽrYrrûr rrrr Ús@ 20 O ÿ