Hacked By AnonymousFox

Current Path : /opt/alt/python35/lib64/python3.5/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/__pycache__/trace.cpython-35.opt-2.pyc



���]5{�@s:ddgZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZ
ddlmZyddlZWn'ek
r�ejZdd�ZYnXdd	�Zd
d�Zdd�Zd
Zejd�ZGdd�d�Zdd�Zdd�ZGdd�d�Zdd�Zdd�Zddd�Z dd�Z!Gdd�d�Z"dd �Z#dd!d"�Z$d#d$�Z%Gd%d&�d&e�Z&d'd(�Z'd)d*�Z(d+d,�Z)d-d.�Z*dd/d0�Z+d1d2�Z,e-d3kr6e$�dS)4�Trace�CoverageResults�N)�warn)�	monotoniccCstjd�dS)N)�sys�settrace�rr�*/opt/alt/python35/lib64/python3.5/trace.py�_unsettraceEsr
cCstj|�tj|�dS)N)�	threadingrr)�funcrrr	�	_settraceHs
r
cCstjd�tjd�dS)N)rrrrrrr	r
Ls
cCs|jdtjd�dS)Na	Usage: %s [OPTIONS] <file> [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 <module>.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>     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=<dir>  Directory where the report files.  The coverage
                      report for <package>.<module> is written to file
                      <dir>/<package>/<module>.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.)
-g, --timing          Prefix each line with the time since the program started.
                      Only used while tracing.

Filters, may be repeated multiple times:
--ignore-module=<mod> Ignore the given module(s) and its submodules
                      (if it is a package).  Accepts comma separated
                      list of module names
--ignore-dir=<dir>    Ignore files in the given directory (multiple
                      directories can be joined by os.pathsep).
r)�writer�argv)�outfilerrr	�_usagePs*rz#pragma NO COVERz^\s*(#.*)?$c@s.eZdZdddd�Zdd�ZdS)�_IgnoreNcCsS|st�n	t|�|_|s*gndd�|D�|_ddi|_dS)NcSs"g|]}tjj|��qSr)�os�path�normpath)�.0�drrr	�
<listcomp>�s	z$_Ignore.__init__.<locals>.<listcomp>z<string>�)�set�_mods�_dirs�_ignore)�self�modules�dirsrrr	�__init__�s
z_Ignore.__init__cCs�||jkr|j|S||jkr:d|j|<dSx5|jD]*}|j|d�rDd|j|<dSqDW|dkr�d|j|<dSx8|jD]-}|j|tj�r�d|j|<dSq�Wd|j|<dS)Nr�.r)rr�
startswithrr�sep)r�filename�
modulename�modrrrr	�names�s$




z
_Ignore.names)�__name__�
__module__�__qualname__r!r(rrrr	r�srcCs.tjj|�}tjj|�\}}|S)N)rr�basename�splitext)r�baser%�extrrr	�_modname�sr0cCstjj|�}d}xitjD]^}tjj|�}|j|�r"|t|�tjkr"t|�t|�kr"|}q"W|r�|t|�dd�}n|}tjj|�\}}|jtjd�}tj	r�|jtj	d�}tjj
|�\}}|jd�S)N�rr")rr�normcaserr#�lenr$�
splitdrive�replace�altsepr-�lstrip)rZcomparepathZlongest�dirr.Zdriver%r/rrr	�_fullmodname�s (
	r9c@sgeZdZddddddd�Zdd�Zdd�Zdd	dd
d�Zddd
�ZdS)rNcCs]||_|jdkr!i|_|jj�|_||_|jdkrTi|_|jj�|_||_|jdkr�i|_|jj�|_||_||_|jrYyTt|jd��}tj	|�\}}}WdQRX|j
|j|||��WnNtt
tfk
rX}z%td|j|fdtj�WYdd}~XnXdS)N�rbzSkipping counts file %r: %s�file)�counts�copyZcounter�calledfuncs�callers�infiler�open�pickle�load�update�	__class__�OSError�EOFError�
ValueError�printr�stderr)rr<r>r@r?r�f�errrrr	r!�s,									 zCoverageResults.__init__cCs|jd�o|jd�S)N�<�>)r#�endswith)rr%rrr	�is_ignored_filename�sz#CoverageResults.is_ignored_filenamec	Cs�|j}|j}|j}|j}|j}|j}x,|D]$}|j|d�||||<q=Wx|D]}d||<qlWx|D]}d||<q�WdS)Nrr)r<r>r?�get)	r�otherr<r>r?Zother_countsZother_calledfuncsZ
other_callers�keyrrr	rD�s						
"

zCoverageResults.updateTFc!Cs�|jrZt�td�|j}x4t|�D]&\}}}td|||f�q0W|jr$t�td�d}}	x�t|j�D]�\\}
}}\}
}}|
|kr�t�td|
d�|
}d}	|
|
kr|	|
krtd|
�|
}	td||||f�q�Wi}xH|jD]=\}}|j|i�}||<|j||f||<q4Wi}x�|j�D]x\}}|j|�r�q�|jd�r�|dd�}|dkr�t	j
jt	j
j|��}t
|�}n1|}t	j
j|�s#t	j|�t|�}|rDt|�}ni}|r�tj|�}t	j
j||d
�}t|d��}tj|j�\}}WdQRX|j|||||�\}}|r�|r�td||�}||||f||<q�W|rY|rYtd
�x<t|�D].}||\}}}}td||�q'W|jr�y5tj|j|j|jft|jd�d	�Wn<tk
r�} ztd| dtj �WYdd} ~ XnXdS)Nzfunctions called:z*filename: %s, modulename: %s, funcname: %szcalling relationships:r1z***z  -->z    %s.%s -> %s.%sz.pycrz.coverr:�dzlines   cov%   module   (path)z%5d   %3d%%   %s   (%s)�wbz"Can't save counts files because %sr;���)!r>rI�sortedr?r<rQ�itemsrPrOrr�dirname�abspathr0�exists�makedirsr9�_find_executable_linenos�	linecache�getlines�joinrA�tokenize�detect_encoding�readline�write_results_file�intrrB�dumprFrrJ)!rZshow_missing�summary�coverdirZcallsr%r&�funcnameZlastfileZ	lastcfileZpfileZpmodZpfunc�cfileZcmodZcfuncZper_file�lineno�	lines_hitZsums�countr8�lnotab�sourceZ	coverpath�fp�encoding�_�n_hits�n_lines�percent�mrLrrr	�
write_results
s~	
		

+


	zCoverageResults.write_resultscCsRyt|dd|�}WnFtk
ra}z&td||fdtj�dSWYdd}~XnXd}d}	|��x�t|d�D]�\}
}|
|kr�|jd||
�|	d7}	|d7}n^tj|�r�|jd�n?|
|krt	|kr|jd	�|d7}n
|jd�|j|j
d
��q�WWdQRX|	|fS)N�wrqz2trace: Could not open %r for writing: %s- skippingr;rrz%5d: z       z>>>>>> �)rr)rArFrIrrJ�	enumerater�rx_blank�match�PRAGMA_NOCOVER�
expandtabs)rr�linesrnrlrqrrLrtrsrk�linerrr	rd`s,




!z"CoverageResults.write_results_file)r)r*r+r!rPrDrwrdrrrr	r�s	VcCs@i}x3tj|�D]"\}}||krd||<qW|S)Nr)�disZfindlinestarts)�code�strs�linenosrrrkrrr	�_find_lines_from_code�s
r�cCsLt||�}x6|jD]+}tj|�r|jt||��qW|S)N)r��	co_consts�inspectZiscoderD�_find_lines)r�r�r��crrr	r��s
r�c
Cs�i}tj}t|d|���}tj|j�}x�|D]y\}}}}	}
|tjkr�|tjkr�|\}}|	\}
}x%t||
d�D]}d||<q�W|}q=WWdQRX|S)Nrqr)�token�INDENTrAra�generate_tokensrc�STRING�range)r%rqrZ
prev_ttyperK�tokZttypeZtstr�start�endr�ZslineZscolZelineZecol�irrr	�
_find_strings�s	r�cCs�y2tj|��}|j�}|j}WdQRXWnFtk
rz}z&td||fdtj�iSWYdd}~XnXt||d�}t	||�}t
||�S)Nz%Not printing coverage data for %r: %sr;�exec)rarA�readrqrFrIrrJ�compiler�r�)r%rK�progrqrLr�r�rrr	r]�sr]c@s�eZdZddddffddddd�	Zdd�Zddd	d
�Zdd�Zd
d�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)rrrNFc

Cs||_||_t||�|_i|_i|_d|_||_i|_i|_	i|_
d|_|	r~t�|_|r�|j
|_n�|r�|j|_nr|r�|r�|j|_|j|_nK|r�|j|_|j|_n*|r|j|_|j|_n	d|_dS)Nrr)r@rr�ignorer<Zpathtobasename�	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)
rrmr��
countfuncs�countcallers�
ignoremods�
ignoredirsr@r�timingrrr	r!�s6										zTrace.__init__cCs,ddl}|j}|j|||�dS)Nr)�__main__�__dict__�runctx)r�cmdr��dictrrr	�run�s	z	Trace.runc
Csf|dkri}|dkr$i}|js:t|j�zt|||�Wd|jsat�XdS)N)r�r
r�r�r
)rr��globals�localsrrr	r��s	
	zTrace.runctxcOsPd}|jstj|j�z|||�}Wd|jsKtjd�X|S)N)r�rrr�)rr�args�kw�resultrrr	�runfuncs		z
Trace.runfuncc
CsP|j}|j}|r't|�}nd}|j}d}||jkrn|j|dk	r'|j|}n�d|j|<dd�tj|�D�}t|�dkr'dd�tj|d�D�}t|�dkr'dd�tj|d�D�}	t|	�dkr'|	dj}||j|<|dk	rCd||f}|||fS)NcSs%g|]}tj|�r|�qSr)r�Z
isfunction)rrKrrr	rs	z1Trace.file_module_function_of.<locals>.<listcomp>rcSs%g|]}t|t�r|�qSr)�
isinstancer�)rrrrr	r#s	rcSs%g|]}t|d�r|�qS)�	__bases__)�hasattr)rr�rrr	r&s	z%s.%s)	�f_code�co_filenamer0�co_namer��gcZ
get_referrersr3r))
r�framer�r%r&riZclsnameZfuncsZdicts�classesrrr	�file_module_function_ofs,			
  

zTrace.file_module_function_ofcCsD|dkr@|j|�}|j|j�}d|j||f<dS)N�callr)r��f_backr�)rr��why�arg�	this_funcZparent_funcrrr	r�5szTrace.globaltrace_trackcallerscCs,|dkr(|j|�}d|j|<dS)Nr�r)r�r�)rr�r�r�r�rrr	r�@szTrace.globaltrace_countfuncscCs�|dkr�|j}|jjdd�}|r�t|�}|dk	r�|jj||�}|s�|jr�td||jf�|j	SndSdS)Nr��__file__z! --- modulename: %s, funcname: %s)
r��	f_globalsrQr0r�r(r�rIr�r�)rr�r�r�r�r%r&Z	ignore_itrrr	r�Is		
zTrace.globaltrace_ltcCs�|dkr�|jj}|j}||f}|jj|d�d|j|<|jrttdt�|jdd�tj	j
|�}td||tj||�fdd�|j
S)	Nr�rrz%.2fr�� z
%s(%d): %sr1)r�r��f_linenor<rQr�rIr�rrr,r^�getliner�)rr�r�r�r%rkrS�bnamerrr	r�`s	 	z Trace.localtrace_trace_and_countcCs�|dkr�|jj}|j}|jrHtdt�|jdd�tjj|�}td||t	j
||�fdd�|jS)Nr�z%.2fr�r�z
%s(%d): %sr1)r�r�r�r�rIr�rrr,r^r�r�)rr�r�r�r%rkr�rrr	r�os		zTrace.localtrace_tracecCsT|dkrM|jj}|j}||f}|jj|d�d|j|<|jS)Nr�rr)r�r�r�r<rQr�)rr�r�r�r%rkrSrrr	r�|s	 zTrace.localtrace_countc
Cs1t|jd|jd|jd|jd|j�S)Nr@rr>r?)rr<r@rr�r�)rrrr	�results�s		z
Trace.results)r)r*r+r!r�r�r�r�r�r�r�r�r�r�r�rrrr	r�s0)	
cCs2tjjdtjd|f�tjd�dS)Nz%s: %s
rr)rrJrr�exit)�msgrrr	�	_err_exit�s!r�c#Cs,ddl}|dkr!tj}yV|j|dd�ddddddd	d
ddd
dddddg�\}}Wnq|jk
r�}zNtjjdtjd|f�tjjdtjd�tjd�WYdd}~XnXd}d}d}d}d}	d}
g}g}d}
d}d}d}d}x�|D]�\}}|dkrrttj�tjd�|dkr�tjjd�tjd�|dks�|dkr�d}q@|dks�|dkr�d}q@|dks�|dkr�d}q@|d ks|d!krd}q@|d"ks7|d#kr@d}q@|d$ksX|d%krad}q@|d&ksy|d'kr�d}q@|d(ks�|d)kr�|}	q@|d*ks�|d+kr�d}
q@|d,ks�|d-kr�|}
q@|d.ks�|d/krd}q@|d0krBx*|j	d1�D]}|j
|j��q"Wq@|d2kr@x�|j	tj
�D]�}tjj|�}|jd3tjjtjd4d5tjdd6���}|jd7tjjtjd4d5tjdd6���}tjj|�}|j
|�qaWq@q@W|r/|s%|r/td8�|pJ|pJ|pJ|pJ|sWtd9�|rm|rmtd:�|r�|	r�td;�|r�t|�dkr�td<�|r�td=|	d>|	�}|j|
d
|d?|
�nK|t_|d}tjj	|�dtjd<t||d@|dA|dB|dC|d=|	d>|	d|�}yct|��}t|j�|dD�}WdQRXdE|dFdGdHddIdi}|j|||�WnQtk
r�}z tdJtjd|f�WYdd}~Xnt k
r�YnX|j!�}|s(|j|
d
|d?|
�dS)KNrrztcrRf:d:msC:lTg�help�versionr�rm�reportz	no-reportrgzfile=�missingzignore-module=zignore-dir=z	coverdir=�	listfuncsZ
trackcallsr�z%s: %s
z%Try `%s --help' for more information
Fz--helpz	--versionz
trace 2.0
z-Tz--trackcallsTz-lz--listfuncsz-gz--timingz-tz--tracez-cz--countz-rz--reportz-Rz--no-reportz-fz--filez-mz	--missingz-Cz
--coverdirz-sz	--summaryz--ignore-module�,z--ignore-dirz$prefix�lib�python�z$exec_prefixz8cannot specify both --listfuncs and (--trace or --count)zLmust specify one of --trace, --count, --report, --listfuncs, or --trackcallsz,cannot specify both --report and --no-reportz--report requires a --filezmissing name of file to runr@rrhr�r�r�r�r�r�r)r��__package__�
__cached__zCannot run file %r because: %s)"�getoptrr�errorrJrr�r�stdout�split�append�stripr�pathsepr�
expandvarsr5r`�base_prefixr��base_exec_prefixrr�r3rrwrrAr�r�r�rF�
SystemExitr�)rr�ZoptsZ	prog_argvr�r�rmr�Z	no_reportZcounts_filer�Zignore_modulesZignore_dirsrhrgr�r�r��opt�valr'�sr�Zprogname�trpr�ZglobsrLrrr	�main�s�		! 


		





	
-
r�cCstdtd�t|�dS)Nz(The trace.usage() function is deprecated�)�_warn�DeprecationWarningr)rrrr	�usage.s
r�c@s"eZdZdddd�ZdS)�IgnoreNcCs'tdtd�tj|||�dS)Nz$The class trace.Ignore is deprecatedr�)r�r�rr!)rrr rrr	r!4s
zIgnore.__init__)r)r*r+r!rrrr	r�3sr�cCstdtd�t|�S)Nz*The trace.modname() function is deprecatedr�)r�r�r0)rrrr	�modname9s
r�cCstdtd�t|�S)Nz.The trace.fullmodname() function is deprecatedr�)r�r�r9)rrrr	�fullmodname>s
r�cCstdtd�t||�S)Nz7The trace.find_lines_from_code() function is deprecatedr�)r�r�r�)r�r�rrr	�find_lines_from_codeCs
r�cCstdtd�t||�S)Nz-The trace.find_lines() function is deprecatedr�)r�r�r�)r�r�rrr	�
find_linesHs
r�cCs tdtd�t|dd�S)Nz/The trace.find_strings() function is deprecatedr�rq)r�r�r�)r%rqrrr	�find_stringsMs
r�cCstdtd�t|�S)Nz:The trace.find_executable_linenos() function is deprecatedr�)r�r�r])r%rrr	�find_executable_linenosRs
r�r�).�__all__r^r�rerr�rar�r�r�rB�warningsrr��timerr�r�ImportErrorrr
r
rr}r�r{rr0r9rr�r�r�r]rr�r�r�r�r�r�r�r�r�r�r)rrrr	�<module>2sV
	-2�
��

Hacked By AnonymousFox1.0, Coded By AnonymousFox