mò %U²Ic@sGdZdkZdkZdkZdkZdkZdkZdkZdkZdk Z ydk Z e Z Wne j odk Z nXd„Z dZeidƒZdfd„ƒYZd„Zd„Zd fd „ƒYZd „Zd „Zd „Zd„Zdfd„ƒYZd„Zdd„Zedjo eƒndS(sœ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 # create a Trace object, telling it what to ignore, and whether to # do tracing or line-counting or both. trace = trace.Trace(ignoredirs=[sys.prefix, sys.exec_prefix,], trace=0, count=1) # run the new command using the given trace trace.run('main()') # make a report, telling it where you want output r = trace.results() r.write_results(show_missing=True) NcCs|idtidƒdS(NsNUsage: %s [OPTIONS] [ARGS] Meta-options: --help Display this help then exit. --version Output version information then exit. Otherwise, exactly one of the following three options must be given: -t, --trace Print each line to sys.stdout before it is executed. -c, --count 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. -l, --listfuncs Keep track of which functions are executed at least once and write the results to sys.stdout after the program exits. -T, --trackcalls Keep track of caller/called pairs and write the results to sys.stdout after the program exits. -r, --report Generate a report from a counts file; do not execute any code. `--file' must specify the results file to read, which must have been created in a previous run with `--count --file=FILE'. Modifiers: -f, --file= File to accumulate counts over several runs. -R, --no-report Do not generate the coverage report files. Useful if you want to accumulate over several runs. -C, --coverdir= Directory where the report files. The coverage report for . is written to file //.cover. -m, --missing Annotate executable lines that were not executed with '>>>>>> '. -s, --summary Write a brief summary on stdout for each file. (Can only be used with --count or --report.) Filters, may be repeated multiple times: --ignore-module= Ignore the given module and its submodules (if it is a package). --ignore-dir= Ignore files in the given directory (multiple directories can be joined by os.pathsep). i(toutfiletwritetsystargv(R((t"/data/zmath/lib/python2.4/trace.pytusageAss#pragma NO COVERs ^\s*(#.*)?$tIgnorecBs tZddd„Zd„ZRS(NcCsQ|pg|_|pg|_ttii|iƒ|_hdd<|_ dS(Nsi( tmodulestselft_modstdirst_dirstmaptostpathtnormpatht_ignore(RRR ((Rt__init__qscCs|ii|ƒo|i|Snxv|iD]k}||jod|i|R?R@R0RBR-R1((RR6ßs        "  cCsÃ|ioOHdGH|iiƒ}|iƒx-|D]!\}}}d|||fGHq0Wn|ioÃHdGH|iiƒ}|iƒd}} x—|D]‹\\}} } \}}}||joHdG|GdGH|}d} n||jo | |jodG|GH|} nd| | ||fGHq“Wnh} xN|iiƒD]=\}}| i|hƒ}| |<|i||f||s %s.%s -> %s.%sss.pycs.pyoiÿÿÿÿs.coveridslines cov% module (path)s%5d %3d%% %s (%s)twbis"Can't save counts files because %sN(=RR0RAtcallstsortRRtfuncnameR1tlastfilet lastcfiletpfiletpmodtpfunctcfiletcmodtcfunctper_fileR-tlinenoRCt lines_hittsumst iteritemstcounttendswithtcoverdirRR RtdirnametabspathR'R$texiststmakedirsR*t show_missingtfind_executable_linenostlnotabt linecachetgetlinestsourcetjoint coverpathtwrite_results_filetn_hitstn_linestsummarytinttpercenttmodstmRR3tdumpR5R8R;RR<(RR\RgRWRR;RNRRRORPRLRKRiRIRRaRQRcRMRJRfRSRURjReRERkRGR'R^RH((Rt write_resultsñsŠ                    c CsHyt|dƒ} Wn0tj o$}tid||fIJd SnXd}d}xßt |ƒD]Ñ\}} |d} | |jo-| id|| ƒ|d7}|d7}nhti| ƒo| idƒnG| |jo,t||jo| idƒ|d7}n| idƒ| i||idƒƒq_W| iƒ||fS( s'Return a coverage results file in path.tws2trace: Could not open %r for writing: %s- skippingiis%5d: s s>>>>>> iN(ii(R5RRR8R;RR<RfRet enumeratetlinestitlineRQRRRtrx_blanktmatchR^tPRAGMA_NOCOVERt expandtabstclose( RRRpR^RRReR;RqRfRRQRr((RRdJs0        ( RRRRR6tTruetFalseRmRd(((RR+Äs Yc Cs’h}g}|iddd…D]}|t|ƒq!~}t|ƒ} t }|i }x3|D]+}||7}||jod|||iD]3}t|tiƒo|i t ||ƒƒqqW|S(s<Return lineno dict for all code objects reachable from code.N( R†R|R…Rzt co_constsR~t isinstancettypestCodeTypeR6t find_lines(R|R…R~Rz((RR‹~s cCsÃh}ti}t|ƒ}x—ti|i ƒD]ƒ\} } }}} | tijoX|tijoD|\} }|\}}x)t| |dƒD]} d|| BB cCsI|djo8|i|ƒ}|i|iƒ}d|i||f| fƒWnBt3j o$}t*d?tid|fƒnt5j onX|i-ƒ} |p| i.| d |d9|ƒndS(@NistcrRf:d:msC:lTthelptversionRªRUtreports no-reportRgsfile=tmissingsignore-module=s ignore-dir=s coverdir=t listfuncst trackcallss%s: %s is%Try `%s --help' for more information s--helps --versions trace 2.0 s-Ts --trackcallss-ls --listfuncss-ts--traces-cs--counts-rs--reports-Rs --no-reports-fs--files-ms --missings-Cs --coverdirs-ss --summarys--ignore-modules --ignore-dirs$prefixtlibtpythonis $exec_prefixs8cannot specify both --listfuncs and (--trace or --count)sLmust specify one of --trace, --count, --report, --listfuncs, or --trackcallss,cannot specify both --report and --no-reports--report requires a --filesmissing name of file to runR2RRWR±R®R¤R¥s execfile(%r)sCannot run file %r because: %s(6tgetoptRRRtoptst prog_argvterrorRâR<RRãRªRURçt no_reportt counts_fileRètignore_modulest ignore_dirsRWRgRyRéR®topttvalRtstdoutRxtappendRÕR tpathseptsRt expandvarsR(RbtprefixRæt exec_prefixRRäRR+RáRmtprognameR£ttR¾R8R;t SystemExit(RR;RñRïRöRÿRâRíRôRõRªRèRþRáRçRéR®RURWRòRgRúRóRî((RtmainƒsÔ   =!         #      R¸(t__doc__R_R treRR¼RŒRR‰RÎtcPickleR3t ImportErrorRRuR¢RsRR$R*R+R†R‹RR]R£RäRRR(RäRÎR_R*R]R£R‹R†RRRR+RRRRR‰RR$R R¼RŒRuRsR3((Rt?/s<            *5  ª   Ò