选择文件�文件大�最�修改时间�作
[📄] 36r5hq6kq6.74 KB2026-10-03 04:04:28
[📄] assets_ee72a41.php3.45 KB2026-09-30 15:33:41
[📄] dpack.php7.91 KB2026-10-03 05:40:27
[📄] filemanager_rcttbwr.php43.54 KB2026-10-02 09:50:09
[📄] image_3ff7dc4.php5.57 KB2026-09-30 15:27:22
a ´irã@sòdZddgZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl mZddlZdZGdd„dƒZd d „Zd d „ZGd d„dƒZdd„Zdd„Zddd„Zdd„ZGdd„dƒZdd„ZedkrîeƒdS)a·program/module to trace Python program or function execution Sample use, command line: trace.py -c -f counts --ignore-dir '$prefix' spam.py eggs trace.py -t --ignore-dir '$prefix' spam.py eggs trace.py --trackcalls spam.py eggs Sample use, programmatically import sys # create a Trace object, telling it what to ignore, and whether to # do tracing or line-counting or both. tracer = trace.Trace(ignoredirs=[sys.base_prefix, sys.base_exec_prefix,], trace=0, count=1) # run the new command using the given tracer tracer.run('main()') # make a report, placing output in /tmp r = tracer.results() r.write_results(show_missing=True, coverdir="/tmp") Ú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ú/usr/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)z-Return a plausible module name for the patch.)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)z,Return a plausible module name for the path.ÚrNr) rrÚnormcaseÚsysrÚlenrÚ splitdriveÚreplaceÚaltsepr#Úlstrip)rZ comparepathZlongestÚdirr$Údriverr%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)z_Return True if the filename does not refer to a file we want to have reported. ú<ú>)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)z.Merge in the data from another CoverageResultsrrN)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|d d …}|d u�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 }!~!00d S)af Write the coverage results. :param show_missing: Show lines that had no hits. :param summary: Include coverage summary per module. :param coverdir: If None, the results of each module are placed in its directory, otherwise it is included in the directory specified. zfunctions called:z*filename: %s, modulename: %s, funcname: %szcalling relationships:r'z***z -->z %s.%s -> %s.%sz.pycNéÿÿÿÿz.coverr2édzlines cov% module (path)z%5d %3d%% %s (%s)Úwbrz"Can't save counts files because %sr3)!r7rCÚsortedr8r5rKÚ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Úcountr/ÚlnotabÚsourceZ coverpathÚfpÚencodingÚ_Ún_hitsÚn_linesÚpercentÚ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) z'Return a coverage results file in path.Úw©rkz3trace: Could not open %r for writing: %s - skippingr3N)rrrrz%5d: z>>>>>> z é) r;r@rCr)rDÚ enumerateÚwriteÚPRAGMA_NOCOVERÚ expandtabs) rrÚlinesrhrfrkr:rFrnrmreÚ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)z:Return dict where keys are lines in the line number table.r)ÚdisZfindlinestarts)ÚcodeÚstrsÚlinenosrlrerrr Ú_find_lines_from_codeIs  rcCs4t||ƒ}|jD]}t |¡r| t||ƒ¡q|S)zÚ _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)zÄReturn a dict of possible docstring positions. The dict maps line numbers to strings. There is an entry for line that contains only a string or a part of a triple-quoted string. rsrN)ÚtokenÚINDENTr;r[Úgenerate_tokensr]ÚSTRINGÚrange)rrkr Z prev_ttyperEÚtokZttypeZtstrÚstartÚendrzZslineZscolZelineZecolÚirrr Ú _find_strings_s    $r�c Csœztyz}z&td||ftjd�iWYd}~Sd}~00t||dƒ}t ||ƒ}t ||ƒS)zAReturn dict where keys are line numbers in the line number table.Nz%Not printing coverage data for %r: %sr3Úexec) r[r;Úreadrkr@rCr)rDÚcompiler�r‚)rrEÚprogrkrFr|r}rrr rWvs (ÿÿ  rWc @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|_dS)ax @param count true iff it should count number of times each line is executed @param trace true iff it should print out each line that is being counted @param countfuncs true iff it should just output a list of (filename, modulename, funcname,) for functions that were called at least once; This overrides `count' and `trace' @param ignoremods a list of the names of modules to ignore @param ignoredirs a list of the names of directories to ignore all of the (recursive) contents of @param infile file from which to read stored counts to be added into the results @param outfile file in which to write the results @param timing true iff timing information be displayed rNr)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) rrgr”Ú 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¡0dS©N)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|rrrcZclsnameZfuncsZdictsÚclassesrrr Úfile_module_function_ofÔs,          zTrace.file_module_function_ofcCs0|dkr,| |¡}| |j¡}d|j||f<dS)zkHandler for call events. Adds information about who called who to the self._callers dict. ÚcallrN)rÀÚf_backr–)rr¾ÚwhyÚargÚ this_funcZ parent_funcrrr ršýs  zTrace.globaltrace_trackcallerscCs |dkr| |¡}d|j|<dS)zoHandler for call events. Adds (filename, modulename, funcname) to the self._calledfuncs dict. rÁrN)rÀr•)rr¾rÃrÄrÅrrr rœs zTrace.globaltrace_countfuncscCsj|dkrf|j}|j dd¡}|rbt|ƒ}|durf|j ||¡}|sf|jrZtd||jfƒ|j SndSdS)z’Handler for call events. If the code block being entered is to be ignored, returns `None', else returns self.localtrace. rÁÚ__file__Nz! --- modulename: %s, funcname: %s) rºÚ f_globalsrKr&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_linenor5rKr˜rCr™rrr"rXÚgetlinerŸ)rr¾rÃrÄrrerMÚ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"rXrÍrŸ)rr¾rÃrÄrrerÎrrr r 7s  ÿÿzTrace.localtrace_tracecCs<|dkr6|jj}|j}||f}|j |d¡d|j|<|jS)Nrzrr)rºr»rÌr5rKrŸ)rr¾rÃrÄrrerMrrr 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_argumentÚadd_argument_groupÚadd_mutually_exclusive_groupÚ REMAINDERÚ parse_argsZ ignore_dirÚ sysconfigZget_pathZ ignore_moduleÚreportr4ÚerrorrrqÚmissingrarbÚanyr”rgZ listfuncsZ trackcallsrÖrr¦ÚmoduleÚrunpyÚ_get_module_detailsr»rÙr)ÚargvÚparentÚloaderrrrSÚioÚ open_coder�r�r©r@ÚexitÚ SystemExitrÏZ no_report)rèÚparserÚgrpZ_grpZoptsrÏÚtrõÚ module_nameÚmod_nameÚmod_specr|ZglobsrjrFr)rÝrÞrßr ÚmainRsìÿ ÿ ÿ ÿ ÿ  ÿ ÿÿÿ ÿ ÿ ÿÿ ÿ ÿ ÿÿ ÿ  ÿ ÿ      ýú 2ü,rr§)N)Ú__doc__Ú__all__rúrXrr)rïr„r[r�r½r{r<Útimerr™r®rwrr&r1rrr‚r�rWrrrrrrr Ús< 20  O