grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026a XC?h$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„ZedkrêeƒdS)ÚTraceÚCoverageResultséN)Ú monotonicz#pragma NO COVERc@seZdZddd„Zdd„ZdS)Ú_IgnoreNcCs:|s tƒnt|ƒ|_|sgn dd„|Dƒ|_ddi|_dS)NcSsg|]}tj |¡‘qS©)ÚosÚpathÚnormpath©Ú.0Údrrú*/opt/alt/python39/lib64/python3.9/trace.pyÚ Hsÿz$_Ignore.__init__..zé)ÚsetÚ_modsÚ_dirsÚ_ignore)ÚselfÚmodulesÚdirsrrr Ú__init__Fs ÿz_Ignore.__init__cCs¦||jvr|j|S||jvr,d|j|<dS|jD]"}| |d¡r2d|j|<dSq2|durld|j|<dS|jD]$}| |tj¡rrd|j|<dSqrd|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|ƒtjkrt|ƒt|ƒkr|}q|rr|t|ƒdd…}n|}tj |¡\}}| tjd¡}tj r¨| tj d¡}tj  |¡\}}|  d¡S)NÚrr) rrÚnormcaseÚsysrÚlenrÚ splitdriveÚreplaceÚaltsepr$Úlstrip)rZ comparepathZlongestÚdirr%Zdriverr&rrr Ú _fullmodname~s    r1c@s:eZdZddd„Zdd„Zdd„Zdd d „Zdd d „ZdS)rNc Cs||_|jduri|_|j ¡|_||_|jdur8i|_|j ¡|_||_|jdurZi|_|j ¡|_||_||_|j�rzTt|jdƒ� }t  |¡\}}}Wdƒn1s®0Y|  |  |||¡¡WnDt t tf�y}z$td|j|ftjd�WYd}~n d}~00dS)NÚrbzSkipping counts file %r: %s©Úfile)ÚcountsÚcopyZcounterÚ calledfuncsÚcallersÚinfileÚoutfileÚopenÚpickleÚloadÚupdateÚ __class__ÚOSErrorÚEOFErrorÚ ValueErrorÚprintr*Ústderr)rr5r7r9r8r:ÚfÚerrrrr r›s2      .ÿÿzCoverageResults.__init__cCs| d¡o| d¡S)Nú<ú>)rÚendswith)rrrrr Úis_ignored_filenameµsz#CoverageResults.is_ignored_filenamec Csn|j}|j}|j}|j}|j}|j}|D]}| |d¡||||<q(|D] }d||<qJ|D] }d||<q\dS©Nrr)r5r7r8Úget) rÚotherr5r7r8Z other_countsZother_calledfuncsZ other_callersÚkeyrrr r>»s zCoverageResults.updateTFc" Cs|jr@tƒtdƒ|j}t|ƒD]\}}}td|||fƒq"|jrÐtƒtdƒd}} t|jƒD]h\\} } } \} }}| |krœtƒtd| dƒ| }d} | | krº| | krºtd| ƒ| } td| | ||fƒqfi}|jD].\}}| |i¡}||<|j||f||<qÚi}| ¡D�],\}}| |¡�r0�q| d¡�rH|dd …}|du�rpt j   t j   |¡¡}t |ƒ}n$|}t j  |¡�sŒt  |¡t|ƒ}|�r¤t|ƒ}ni}t |¡}t j  ||d ¡}t|d ƒ� }t |j¡\}}Wdƒn1�sö0Y| |||||¡\}}|�r|�rtd ||ƒ}||||f||<�q|�rŠ|�rŠtd ƒt|ƒD]&}||\}}}}td||ƒ�qb|j�rzLt|jdƒ�*} t |j|j|jf| d¡Wdƒn1�sÒ0YWn8t�y}!ztd|!tj d�WYd}!~!n d}!~!00dS)Nzfunctions called:z*filename: %s, modulename: %s, funcname: %szcalling relationships:r(z***z -->z %s.%s -> %s.%sz.pycéÿÿÿÿz.coverr2édzlines cov% module (path)z%5d %3d%% %s (%s)Úwbrz"Can't save counts files because %sr3)!r7rCÚsortedr8r5rLÚitemsrJrIrrÚdirnameÚabspathr'ÚexistsÚmakedirsr1Ú_find_executable_linenosÚ linecacheÚgetlinesÚjoinr;ÚtokenizeÚdetect_encodingÚreadlineÚwrite_results_fileÚintr:r<Údumpr@r*rD)"rZ show_missingÚsummaryÚcoverdirZcallsrrÚfuncnameZlastfileZ lastcfileZpfileZpmodZpfuncÚcfileZcmodZcfuncZper_fileÚlinenoÚ lines_hitZsumsÚcountr0ÚlnotabÚsourceZ coverpathÚfpÚencodingÚ_Ún_hitsÚn_linesZpercentÚmrErFrrr Ú write_resultsÍs„ ÿÿ           0ÿ   ÿ(zCoverageResults.write_resultsc Cszt|d|d�}Wn<tyN}z$td||ftjd�WYd}~dSd}~00d}d} |�Žt|dƒD]r\} } | |vrœ| d|| ¡| d7} |d7}n.| |vrÀt| vrÀ| d ¡|d7}n | d ¡| |  d ¡¡qhWdƒn1sð0Y| |fS) NÚw©rlz3trace: Could not open %r for writing: %s - skippingr3)rrrrz%5d: z>>>>>> z é) r;r@rCr*rDÚ enumerateÚwriteÚPRAGMA_NOCOVERÚ expandtabs) rrÚlinesrirgrlr:rFrornrfÚlinerrr r_)s.ÿÿ    0z"CoverageResults.write_results_file)NNNNN)TFN)N)rr r!rrJr>rqr_rrrr ršsÿ  \cCs,i}t |¡D]\}}||vrd||<q|S)Nr)ÚdisZfindlinestarts)ÚcodeÚstrsÚlinenosrmrfrrr Ú_find_lines_from_codeIs  rcCs4t||ƒ}|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}t |j¡}|D]R\}}}} } |tjkrv|tjkrv|\} } | \} }t| | dƒD] }d||<qh|}q(Wdƒn1s�0Y|S)Nrsr)ÚtokenÚINDENTr;r\Úgenerate_tokensr^ÚSTRINGÚrange)rrlr Z prev_ttyperEÚtokZttypeZtstrÚstartÚendrzZslineZscolZelineZecolÚirrr Ú _find_strings_s    $r�c Csœztyz}z&td||ftjd�iWYd}~Sd}~00t||dƒ}t ||ƒ}t ||ƒS)Nz%Not printing coverage data for %r: %sr3Úexec) r\r;Úreadrlr@rCr*rDÚcompiler�r‚)rrEÚprogrlrFr|r}rrr rXvs (ÿÿ  rXc @speZdZddd„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|_ | rTt ƒ|_ |rb|j |_nZ|rp|j|_nL|rŠ|rŠ|j|_|j|_n2|r |j|_|j|_n|r¶|j|_|j|_nd|_dSrK)r9r:rÚignorer5ZpathtobasenameÚ 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) rrhr”Ú countfuncsÚ countcallersÚ ignoremodsÚ ignoredirsr9r:Útimingrrr r…s6      zTrace.__init__cCs ddl}|j}| |||¡dS)Nr)Ú__main__Ú__dict__Úrunctx)rÚcmdr§Údictrrr Úrun·sz Trace.runc Cs‚|dur i}|duri}|js6t |j¡t |j¡z*t|||ƒW|js~t d¡t d¡n|js|t d¡t d¡0dSr")r“Ú threadingÚsettracer›r*rŽ)rrªÚglobalsÚlocalsrrr r©¼s      þ z Trace.runctxc OsPd}|jst |j¡z"||i|¤Ž}W|jsLt d¡n|jsJt d¡0|Sr")r“r*r®r›)rÚfuncÚargsÚkwÚresultrrr ÚrunfuncÉs  ÿ z Trace.runfuncc Csð|j}|j}|rt|ƒ}nd}|j}d}||jvrL|j|durÒ|j|}n†d|j|<dd„t |¡Dƒ}t|ƒdkrÒdd„t |d¡Dƒ}t|ƒdkrÒdd„t |d¡Dƒ} t| ƒdkrÒ| dj}||j|<|duræd||f}|||fS)NcSsg|]}t |¡r|‘qSr)r�Z isfunction)r rErrr rås ÿz1Trace.file_module_function_of..rcSsg|]}t|tƒr|‘qSr)Ú isinstancer«r rrr rës ÿrcSsg|]}t|dƒr|‘qS)Ú __bases__)Úhasattr)r rƒrrr rîs ÿz%s.%s) Úf_codeÚ co_filenamer'Úco_namer—ÚgcZ get_referrersr+r) rÚframer|rrrdZclsnameZfuncsZdictsÚclassesrrr Úfile_module_function_ofÔs,          zTrace.file_module_function_ofcCs0|dkr,| |¡}| |j¡}d|j||f<dS©NÚcallr)r¿Úf_backr–)rr½ÚwhyÚargÚ this_funcZ parent_funcrrr ršýs  zTrace.globaltrace_trackcallerscCs |dkr| |¡}d|j|<dSrÀ)r¿r•)rr½rÃrÄrÅrrr rœs zTrace.globaltrace_countfuncscCsj|dkrf|j}|j dd¡}|rbt|ƒ}|durf|j ||¡}|sf|jrZtd||jfƒ|j SndSdS)NrÁÚ__file__z! --- modulename: %s, funcname: %s) r¹Ú f_globalsrLr'r’rr”rCr»rŸ)rr½rÃrÄr|rrZ ignore_itrrr r�sÿzTrace.globaltrace_ltcCs„|dkr~|jj}|j}||f}|j |d¡d|j|<|jrTtdtƒ|jdd�tj   |¡}td||t   ||¡fdd�|j S) Nrzrrú%.2fú ©r‹ú %s(%d): %sr()r¹rºÚf_linenor5rLr˜rCr™rrr#rYÚgetlinerŸ)rr½rÃrÄrrfrNÚbnamerrr rž(s  ÿÿz Trace.localtrace_trace_and_countcCsd|dkr^|jj}|j}|jr4tdtƒ|jdd�tj |¡}td||t   ||¡fdd�|j S)NrzrÈrÉrÊrËr() r¹rºrÌr˜rCr™rrr#rYrÍrŸ)rr½rÃrÄrrfrÎrrr r 7s  ÿÿzTrace.localtrace_tracecCs<|dkr6|jj}|j}||f}|j |d¡d|j|<|jS)Nrzrr)r¹rºrÌr5rLrŸ)rr½rÃrÄrrfrNrrr r¡Ds zTrace.localtrace_countcCst|j|j|j|j|jd�S)N)r9r:r7r8)rr5r9r:r•r–)rrrr ÚresultsLs  ýz Trace.results) rrrrrrNNF)NN)rr 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;�| ¡}|j�rˆ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�rB|j�s8|j�rB|  dH¡|j�r\|j�s\|  dI¡|jdu�rr|  dJ¡t|j|j|j|j|j |j|j |j |jdK� }zÖ|j�rðddl}|j}| |¡\} } } | jg|j¢t _!dL| j| j"| j#| ddMœ} nt|jg|j¢t _!t$j% &|j¡t j%d<t' (|j¡�"} t)|  *¡|jdNƒ} Wdƒn1�sJ0Y|jdLdddOœ} | +| | | ¡WnPt,�y²}z$t  -dPt j!d|f¡WYd}~nd}~0t.�yÄYn0| /¡}|j0�sê| |j|j|j¡dS)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�szmain..parse_ignore_dircSs$g|]}| d¡D] }| ¡‘qqS)ú,)ÚsplitÚstrip)r rŒrrrr r¢sÿzmain..cs&g|]}| tj¡D] }ˆ|ƒ‘qqSr)rárÚpathsep)r rŒrÜ)rßrr r¤sÿz-r/--report requires -f/--file)r9r: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¥r9r:r¦r§)rrÆÚ __package__Ú __loader__Ú__spec__Ú __cached__rŽ)rÆrrä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_moduleZreportr4ÚerrorrrqZmissingrbrcÚanyr”rhZ listfuncsZ trackcallsrÖrr¦ÚmoduleÚrunpyZ_get_module_detailsrºrÙr*ÚargvÚparentÚloaderrrrTÚioÚ open_coder�r�r©r@ÚexitÚ SystemExitrÏZ no_report)rèÚparserZgrpZ_grpZoptsrÏÚtrðZ module_nameZmod_nameZmod_specr|ZglobsrkrFr)rÝrÞrßr ÚmainRsìÿ ÿ ÿ ÿ ÿ  ÿ ÿÿÿ ÿ ÿ ÿÿ ÿ ÿ ÿÿ ÿ  ÿ ÿ      ýú 2ü,rúr§)N)Ú__all__rôrYrr*rìr„r\r�r¼r{r<Útimerr™r­rwrr'r1rrr‚r�rXrrúrrrrr Ú2s: 20  O