Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325
3 \3pã @s,dZddgZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl mZy ddlZWn"ek ržejZdd„ZYnXdd „Zd d„Zd ZGd d „d ƒZdd„Zdd„ZGdd„dƒZdd„Zdd„Zddd„Zdd„ZGdd„dƒZdd„Ze dk�r(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)Ú monotoniccCstjdƒdS)N)ÚsysÚsettrace©rrú/usr/lib64/python3.6/trace.pyÚ _unsettraceEsr cCstj|ƒtj|ƒdS)N)Ú threadingrr)ÚfuncrrrÚ _settraceHs r cCstjdƒtjdƒdS)N)rrr rrrrr Ls z#pragma NO COVERc@seZdZddd„Zdd„ZdS)Ú_IgnoreNcCs:|s tƒnt|ƒ|_|sgn dd„|Dƒ|_ddi|_dS)NcSsg|]}tjj|ƒ‘qSr)ÚosÚpathÚnormpath)Ú.0Údrrrú Usz$_Ignore.__init__..zé)ÚsetÚ_modsÚ_dirsÚ_ignore)ÚselfÚmodulesÚdirsrrrÚ__init__Ss z_Ignore.__init__cCsª||jkr|j|S||jkr,d|j|<dSx*|jD] }|j|dƒr4d|j|<dSq4W|dkrnd|j|<dSx,|jD]"}|j|tjƒrvd|j|<dSqvWd|j|<dS)NrÚ.r)rrÚ startswithrrÚsep)rÚfilenameÚ modulenameÚmodrrrrÚnamesYs$          z _Ignore.names)NN)Ú__name__Ú __module__Ú __qualname__rr#rrrrr Rs r cCs tjj|ƒ}tjj|ƒ\}}|S)z-Return a plausible module name for the patch.)rrÚbasenameÚsplitext)rÚbaser ÚextrrrÚ_modname„s r+cCsÆtjj|ƒ}d}xJtjD]@}tjj|ƒ}|j|ƒr|t|ƒtjkrt|ƒt|ƒkr|}qW|rv|t|ƒdd…}n|}tjj|ƒ\}}|jtjdƒ}tj r¬|jtj dƒ}tjj |ƒ\}}|j dƒS)z,Return a plausible module name for the path.ÚrNr) rrÚnormcaserrÚlenrÚ splitdriveÚreplaceÚaltsepr(Úlstrip)rZ comparepathZlongestÚdirr)Zdriver r*rrrÚ _fullmodname‹s    r4c@s:eZdZddd„Zdd„Zdd„Zdd d „Zdd d „ZdS)rNcCsþ||_|jdkri|_|jjƒ|_||_|jdkr8i|_|jjƒ|_||_|jdkrZi|_|jjƒ|_||_||_|jrúy@t|jdƒ�}tj |ƒ\}}}WdQRX|j |j |||ƒƒWn@t t tfk rø}ztd|j|ftjd�WYdd}~XnXdS)NÚrbzSkipping counts file %r: %s)Úfile)ÚcountsÚcopyZcounterÚ calledfuncsÚcallersÚinfileÚoutfileÚopenÚpickleÚloadÚupdateÚ __class__ÚOSErrorÚEOFErrorÚ ValueErrorÚprintrÚstderr)rr7r9r;r:r<ÚfÚerrrrrr¨s,      zCoverageResults.__init__cCs|jdƒo|jdƒS)z_Return True if the filename does not refer to a file we want to have reported. ú<ú>)rÚendswith)rr rrrÚis_ignored_filenameÂsz#CoverageResults.is_ignored_filenamec Csz|j}|j}|j}|j}|j}|j}x$|D]}|j|dƒ||||<q*Wx|D] }d||<qPWx|D] }d||<qfWdS)z.Merge in the data from another CoverageResultsrrN)r7r9r:Úget) rÚotherr7r9r:Z other_countsZother_calledfuncsZ other_callersÚkeyrrrr@Ès    zCoverageResults.updateTFc!Csô|jrDtƒtdƒ|j}x(t|ƒD]\}}}td|||fƒq$W|jrØtƒtdƒd}} xvt|jƒD]h\\} } } \} }}| |kr¢tƒtd| dƒ| }d} | | krÀ| | krÀtd| ƒ| } td| | ||fƒqlWi}x8|jD].\}}|j|iƒ}||<|j||f||<qäWi}�x$|jƒD�]\}}|j|ƒ�r@�q&|jdƒ�rX|d d…}|d k�r€t j j t j j |ƒƒ}t |ƒ}n$|}t j j|ƒ�sœt j|ƒt|ƒ}|�r´t|ƒ}ni}tj|ƒ}t j j||d ƒ}t|d ƒ�}tj|jƒ\}}Wd QRX|j|||||ƒ\}}|�r&|�r&td ||ƒ}||||f||<�q&W|�rŠ|�rŠtdƒx2t|ƒD]&}||\}}}}td||ƒ�q`W|j�rðy&tj|j|j|jft|jdƒd ƒWn6tk �rî} ztd| tj d�WYd d } ~ XnXd 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.pycNrz.coverr5édzlines cov% module (path)z%5d %3d%% %s (%s)Úwbz"Can't save counts files because %s)r6éÿÿÿÿ)!r9rEÚsortedr:r7rMÚitemsrLrKrrÚdirnameÚabspathr+ÚexistsÚmakedirsr4Ú_find_executable_linenosÚ linecacheÚgetlinesÚjoinr=ÚtokenizeÚdetect_encodingÚreadlineÚwrite_results_fileÚintr<r>ÚdumprBrrF)!rZ show_missingÚsummaryÚcoverdirZcallsr r!ÚfuncnameZlastfileZ lastcfileZpfileZpmodZpfuncÚcfileZcmodZcfuncZper_fileÚlinenoÚ lines_hitZsumsÚcountr3ÚlnotabÚsourceZ coverpathÚfpÚencodingÚ_Ún_hitsÚn_linesZpercentÚmrHrrrÚ write_resultsÚs|              zCoverageResults.write_resultsc Csìyt|d|d�}Wn6tk rH}ztd||ftjd�d Sd}~XnXd}d} |�ˆx€t|dƒD]r\} } | |kr˜|jd|| ƒ| d7} |d7}n.| |kr¼t| kr¼|jd ƒ|d7}n |jd ƒ|j| jd ƒƒqdWWdQRX| |fS) z'Return a coverage results file in path.Úw)rmz3trace: Could not open %r for writing: %s - skipping)r6rNrz%5d: z>>>>>> z é)rr) r=rBrErrFÚ enumerateÚwriteÚPRAGMA_NOCOVERÚ expandtabs) rrÚlinesrjrhrmr<rHrprorgÚlinerrrr`5s(    z"CoverageResults.write_results_file)NNNNN)TFN)N)r$r%r&rrLr@rrr`rrrrr§s   [cCs0i}x&tj|ƒD]\}}||krd||<qW|S)z:Return dict where keys are lines in the line number table.r)ÚdisZfindlinestarts)ÚcodeÚstrsÚlinenosrnrgrrrÚ_find_lines_from_codeUs  rcCs8t||ƒ}x(|jD]}tj|ƒr|jt||ƒƒqW|S)z.rcSsg|]}t|tƒr|‘qSr)Ú isinstancer«)rrrrrrõsrcSsg|]}t|dƒr|‘qS)Ú __bases__)Úhasattr)rrƒrrrrøsz%s.%s) Úf_codeÚ co_filenamer+Úco_namer—ÚgcZ get_referrersr.r$) rÚframer|r r!reZclsnameZfuncsZdictsÚclassesrrrÚfile_module_function_ofÞs,          zTrace.file_module_function_ofcCs0|dkr,|j|ƒ}|j|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_funcrrrršs  zTrace.globaltrace_trackcallerscCs |dkr|j|ƒ}d|j|<dS)zoHandler for call events. Adds (filename, modulename, funcname) to the self._calledfuncs dict. r½rN)r¼r•)rrºr¿rÀrÁrrrrœs zTrace.globaltrace_countfuncscCsj|dkrf|j}|jjddƒ}|rbt|ƒ}|dk rf|jj||ƒ}|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_globalsrMr+r’r#r”rEr¸rŸ)rrºr¿rÀr|r r!Z ignore_itrrrr�szTrace.globaltrace_ltcCs„|dkr~|jj}|j}||f}|jj|dƒd|j|<|jrTtdtƒ|jdd�tj j |ƒ}td||t j ||ƒfdd�|j S) Nrzrrz%.2fú )r‹z %s(%d): %sr,)r¶r·Úf_linenor7rMr˜rEr™rrr'rZÚgetlinerŸ)rrºr¿rÀr rgrOÚbnamerrrrž2s z Trace.localtrace_trace_and_countcCsd|dkr^|jj}|j}|jr4tdtƒ|jdd�tjj|ƒ}td||t j ||ƒfdd�|j S)Nrzz%.2frÄ)r‹z %s(%d): %sr,) r¶r·rÅr˜rEr™rrr'rZrÆrŸ)rrºr¿rÀr rgrÇrrrr As zTrace.localtrace_tracecCs<|dkr6|jj}|j}||f}|jj|dƒd|j|<|jS)Nrzrr)r¶r·rÅr7rMrŸ)rrºr¿rÀr rgrOrrrr¡Ns zTrace.localtrace_countcCst|j|j|j|j|jd�S)N)r;r<r9r:)rr7r;r<r•r–)rrrrÚresultsVs z Trace.results)NN)r$r%r&rr¬r©r²r¼ršrœr�ržr r¡rÈrrrrr�s 0  )   c s’tjƒ}|jdddd�|jddƒ}|jddd d d �|jd d d dd �|jddd dd �|jddd dd �|jdƒ}|jƒ}|jddd dd �|jddd dd �|jdddd�|jd d!d"d�|jd#d$d d%d �|jd&d'd d(d �|jd)d*d d+d �|jd,d-ƒ}|jd.d/gd0d1�|jd2d/gd3d1�|jd4d5d6d7�|jd8tjd9d7�|jƒ}|j�r’d:d;jt j ƒf}t j j t jf|žމt j j t jf|žމ‡‡fdd?„|jDƒ|_‡fd@d?„|jDƒ|_|j�r|j�sâ|jdAƒt|j|jdB�}|j|j|j|jƒSt|j|j|j|jgƒ�s*|jdCƒ|j�rL|j�sB|j�rL|jdDƒ|j�rh|j �rh|jdEƒ|jdk�r~|jdFƒ|jf|j•t _ t j j!|jƒt j dG<t"|j|j|j|j|j|j|j|j|j#dH� }yJt$|jƒ�}t%|j&ƒ|jdIƒ}WdQRX|jdJdddKœ} |j'|| | ƒWnPt(k �rT} zt j)dLt j dG| fƒWYdd} ~ Xnt*k �rhYnX|j+ƒ}|j,�sŽ|j|j|j|jƒdS)MNz --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).r ú?zfile to run as main program)ÚnargsrÌÚ argumentszarguments to the programÚlibzpython{0.major}.{0.minor}cs4tjjtjj|ƒƒ}|jdˆƒjdˆƒ}tjj|ƒS)Nz$prefixz $exec_prefix)rrÚ expanduserÚ expandvarsr0r)Ús)Ú _exec_prefixÚ_prefixrrÚparse_ignore_dir¥szmain..parse_ignore_dircSs$g|]}|jdƒD] }|jƒ‘qqS)ú,)ÚsplitÚstrip)rrŒr"rrrrªszmain..cs&g|]}|jtjƒD] }ˆ|ƒ‘qqSr)rÚrÚpathsep)rrŒrÕ)rØrrr¬sz-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 --reportz3filename is missing: required with the main optionsr)r¢r£r¤r¥r;r<r¦rŽr§)rÂr$Ú __package__Ú __cached__zCannot run file %r because: %s)-ÚargparseÚArgumentParserÚ add_argumentZadd_argument_groupZadd_mutually_exclusive_groupZ REMAINDERÚ parse_argsZ ignore_dirÚformatrÚ version_inforrr\Ú base_prefixÚbase_exec_prefixZ ignore_moduleZreportr6ÚerrorrrrZmissingrcrdÚanyr”riZ listfuncsZ trackcallsr rÑÚargvrUrr¦r=r�r�r©rBÚexitÚ SystemExitrÈZ no_report) ÚparserZgrpZ_grpZoptsZrel_pathrÈÚtrlr|ZglobsrHr)rÖr×rØrÚmain\s¤                       (rîr§)N)!Ú__doc__Ú__all__rßrZrÚrerr„r]r�r¹r{r>Ztimerr™r Ú ImportErrorrr r rwr r+r4rrr‚r�rYrrîr$rrrrÚ1sH  2/  M