Uname: Linux web3.us.cloudlogin.co 5.10.226-xeon-hst #2 SMP Fri Sep 13 12:28:44 UTC 2024 x86_64
Software: Apache
PHP version: 8.1.31 [ PHP INFO ] PHP os: Linux
Server Ip: 162.210.96.117
Your Ip: 3.149.253.168
User: edustar (269686) | Group: tty (888)
Safe Mode: OFF
Disable Function:
NONE

name : trace.cpython-310.opt-2.pyc
o

^br�@s�	ddgZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZ
ddlZdZGdd�d�Zdd	�Zd
d�ZGdd�d�Zd
d�Zdd�Zddd�Zdd�ZGdd�d�Zdd�Zedkrte�dSdS)�Trace�CoverageResults�N)�	monotonicz#pragma NO COVERc@seZdZddd�Zdd�ZdS)�_IgnoreNcCs:|st�nt|�|_|sgndd�|D�|_ddi|_dS)NcSsg|]}tj�|��qS�)�os�path�normpath��.0�drr�./usr/local/python-3.10/lib/python3.10/trace.py�
<listcomp>Gs�z$_Ignore.__init__.<locals>.<listcomp>z<string>�)�set�_mods�_dirs�_ignore)�self�modules�dirsrrr
�__init__Es
�z_Ignore.__init__cCs�||jvr
|j|S||jvrd|j|<dS|jD]}|�|d�r*d|j|<dSq|dur6d|j|<dS|jD]}|�|tj�rKd|j|<dSq9d|j|<dS)Nr�.r)rr�
startswithrr�sep)r�filename�
modulename�modrrrr
�namesKs(





�


�
z
_Ignore.names�NN)�__name__�
__module__�__qualname__rrrrrr
rDs
rcCs"	tj�|�}tj�|�\}}|S�N)rr�basename�splitext)r�baser�extrrr
�_modnamevsr(cCs�	tj�|�}d}tjD] }tj�|�}|�|�r,|t|�tjkr,t|�t|�kr,|}q|r:|t|�dd�}n|}tj�|�\}}|�tjd�}tj	rU|�tj	d�}tj�
|�\}}|�d�S)N�rr)rr�normcase�sysr�lenr�
splitdrive�replace�altsepr%�lstrip)rZcomparepathZlongest�dirr&�driverr'rrr
�_fullmodname}s$
�
r3c@s>eZdZ		ddd�Zdd�Zdd�Zdd
d�Zddd
�ZdS)rNc
Cs||_|jduri|_|j��|_||_|jduri|_|j��|_||_|jdur-i|_|j��|_||_||_|jr�z+t|jd��}t�	|�\}}}Wd�n1sVwY|�
|�|||��WdStt
tfy�}ztd|j|ftjd�WYd}~dSd}~wwdS)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�errrrr
r�s:


������zCoverageResults.__init__cCs	|�d�o
|�d�S)N�<�>)r�endswith)rrrrr
�is_ignored_filename�sz#CoverageResults.is_ignored_filenamec	Csp	|j}|j}|j}|j}|j}|j}|D]}|�|d�||||<q|D]}d||<q&|D]}d||<q/dS�Nrr)r7r9r:�get)	r�otherr7r9r:Zother_countsZother_calledfuncsZ
other_callers�keyrrr
r@�s

�zCoverageResults.updateTFc"
Cs	|jr!t�td�|j}t|�D]\}}}td|||f�q|jrit�td�d}}	t|j�D]4\\}
}}\}
}}|
|krOt�td|
d�|
}d}	|
|
kr^|	|
kr^td|
�|
}	td||||f�q4i}|jD]\}}|�|i�}||<|j||f||<qni}|��D]�\}}|�|�r�q�|�d�r�|dd	�}|dur�t	j
�t	j
�|��}t
|�}n|}t	j
�|�s�t	�|�t|�}|r�t|�}ni}t�|�}t	j
�||d
�}t|d��}t�|j�\}}Wd�n1s�wY|�|||||�\}}|�r|�rtd||�}||||f||<q�|�r=|�r=td
�t|�D]}||\}}}}td||��q)|j�r�z)t|jd��} t�|j|j|jf| d�Wd�WdS1�scwYWdSt�y�}!ztd|!tj d�WYd}!~!dSd}!~!wwdS)Nzfunctions called:z*filename: %s, modulename: %s, funcname: %szcalling relationships:r)z***z  -->z    %s.%s -> %s.%sz.pyc���z.coverr4�dzlines   cov%   module   (path)z%5d   %3d%%   %s   (%s)�wbrz"Can't save counts files because %sr5)!r9rE�sortedr:r7rN�itemsrLrKrr�dirname�abspathr(�exists�makedirsr3�_find_executable_linenos�	linecache�getlines�joinr=�tokenize�detect_encoding�readline�write_results_file�intr<r>�dumprBr+rF)"rZshow_missing�summary�coverdirZcallsrr�funcnameZlastfileZ	lastcfileZpfileZpmodZpfunc�cfileZcmodZcfuncZper_file�lineno�	lines_hitZsums�countr1�lnotab�sourceZ	coverpath�fp�encoding�_�n_hits�n_lines�percent�mrGrHrrr
�
write_results�s�	��






����(� ���zCoverageResults.write_resultsc
Cs
	z	t|d|d�}Wnty(}ztd||ftjd�WYd}~dSd}~wwd}d}	|�Jt|d�D]9\}
}|
|vrO|�d||
�|	d7}	|d7}n|
|vrat|vra|�d	�|d7}n|�d
�|�|�d��q5Wd�|	|fS1s|wY|	|fS)N�w�rnz3trace: Could not open %r for writing: %s - skippingr5)rrrrz%5d: z>>>>>> z       �)	r=rBrEr+rF�	enumerate�write�PRAGMA_NOCOVER�
expandtabs)rr�linesrkrirnr<rHrqrprh�linerrr
ra(s<����



�
��z"CoverageResults.write_results_file)NNNNN)TFNr#)r r!r"rrLr@rtrarrrr
r�s
�
\cCs.	i}t�|�D]\}}||vrd||<q|S)Nr)�disZfindlinestarts)�code�strs�linenosrorhrrr
�_find_lines_from_codeHs�r�cCs6	t||�}|jD]}t�|�r|�t||��q	|Sr#)r��	co_consts�inspectZiscoder@�_find_lines)rr�r��crrr
r�Rs


�r�cCs�	i}tj}t||d��;}t�|j�}|D])\}}}}	}
|tjkr<|tjkr<|\}}|	\}
}t||
d�D]}d||<q5|}qWd�|S1sJwY|S)Nrvr)�token�INDENTr=r^�generate_tokensr`�STRING�range)rrnrZ
prev_ttyperG�tokZttypeZtstr�start�endr}ZslineZscolZelineZecol�irrr
�
_find_strings^s$


�
�
�
r�c
Cs�	zt�|��}|��}|j}Wd�n1swYWnty>}ztd||ftjd�iWYd}~Sd}~wwt||d�}t	||�}t
||�S)Nz%Not printing coverage data for %r: %sr5�exec)r^r=�readrnrBrEr+rF�compiler�r�)rrG�progrnrHrr�rrr
rZus&������

rZc@sveZdZ			ddd�Zdd	�Zdd
d�Zdd
�Zdd�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS) rrrrNFc

Cs�	||_||_t||�|_i|_i|_d|_||_i|_i|_	i|_
d|_|	r+t�|_|r3|j
|_dS|r;|j|_dS|rI|rI|j|_|j|_dS|rU|j|_|j|_dS|ra|j|_|j|_dSd|_dSrM)r;r<r�ignorer7Zpathtobasename�	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)
rrjr��
countfuncs�countcallers�
ignoremods�
ignoredirsr;r<�timingrrr
r�s8
zTrace.__init__cCs ddl}|j}|�|||�dS)Nr)�__main__�__dict__�runctx)r�cmdr��dictrrr
�run�sz	Trace.runc	Cs�|duri}|duri}|jst�|j�t�|j�zt|||�W|js2t�d�t�d�dSdS|jsBt�d�t�d�wwr#)r��	threading�settracer�r+r�)rr��globals�localsrrr
r��s

�
�zTrace.runctxc	OsPd}|jst�|j�z||i|��}W|jst�d�|S|js't�d�wwr#)r�r+r�r�)r�func�args�kw�resultrrr
�runfunc�s
��z
Trace.runfuncc
Cs�|j}|j}|r
t|�}nd}|j}d}||jvr&|j|dur%|j|}nCd|j|<dd�t�|�D�}t|�dkridd�t�|d�D�}t|�dkridd�t�|d�D�}	t|	�dkri|	dj}||j|<|dursd||f}|||fS)NcSsg|]	}t�|�r|�qSr)r�Z
isfunction)rrGrrr
r��
�z1Trace.file_module_function_of.<locals>.<listcomp>rcSsg|]	}t|t�r|�qSr)�
isinstancer�r
rrr
r�r�rcSsg|]	}t|d�r|�qS)�	__bases__)�hasattr)rr�rrr
r�r�z%s.%s)	�f_code�co_filenamer(�co_namer��gcZ
get_referrersr,r )
r�framerrrrfZclsnameZfuncsZdictsZclassesrrr
�file_module_function_of�s.


�



zTrace.file_module_function_ofcCs6	|dkr|�|�}|�|j�}d|j||f<dSdS�N�callr)r��f_backr�)rr��why�arg�	this_funcZparent_funcrrr
r��s
�zTrace.globaltrace_trackcallerscCs&	|dkr|�|�}d|j|<dSdSr�)r�r�)rr�r�r�r�rrr
r�s

�zTrace.globaltrace_countfuncscCsr	|dkr7|j}|j�dd�}|r5t|�}|dur1|j�||�}|s3|jr.td||jf�|j	SdSdSdSdS)Nr��__file__z! --- modulename: %s, funcname: %s)
r��	f_globalsrNr(r�rr�rEr�r�)rr�r�r�rrrZ	ignore_itrrr
r�s$���zTrace.globaltrace_ltcCs�|dkr?|jj}|j}||f}|j�|d�d|j|<|jr*tdt�|jdd�tj	�
|�}td||t�||�fdd�|j
S)	Nr}rr�%.2f� �r��
%s(%d): %sr))r�r��f_linenor7rNr�rEr�rrr$r[�getliner�)rr�r�r�rrhrP�bnamerrr
r�'s
��z Trace.localtrace_trace_and_countcCsd|dkr/|jj}|j}|jrtdt�|jdd�tj�|�}td||t	�
||�fdd�|jS)Nr}r�r�r�r�r))r�r�r�r�rEr�rrr$r[r�r�)rr�r�r�rrhr�rrr
r�6s
��zTrace.localtrace_tracecCs<|dkr|jj}|j}||f}|j�|d�d|j|<|jS)Nr}rr)r�r�r�r7rNr�)rr�r�r�rrhrPrrr
r�CszTrace.localtrace_countcCst|j|j|j|j|jd�S)N)r;r<r9r:)rr7r;r<r�r�)rrrr
�resultsKs

�z
Trace.results)	rrrrrrNNFr)r r!r"rr�r�r�r�r�r�r�r�r�r�r�rrrr
r�s 
�2

)	
cs�ddl}|��}|jdddd�|�dd�}|jdd	d
dd�|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;�|��}|jr�t�	d>��t�	d?����fd@dA��dBdC�|j
D�|_
�fdDdC�|jD�|_|jr�|js�|�
dE�t|j|jdF�}|�|j|j|j�St|j|j|j|jg��s
|�
dG�|j�r|j�s|j�r|�
dH�|j�r+|j�s+|�
dI�|jdu�r6|�
dJ�t|j|j|j|j|j
|j|j|j|jdK�	}zk|j�ruddl}|j}|�|�\}	}
}|jg|j�t _!dL|j|
j"|
j#|
ddM�}n:|jg|j�t _!t$j%�&|j�t j%d<t'|jdN��}
t(|
�)�|jdO�}Wd�n	1�s�wY|jdLdddP�}|�*|||�Wn(t+�y�}zt �,dQt j!d|f�WYd}~nd}~wt-�y�Ynw|�.�}|j/�s�|�|j|j|j�dSdS)RNrz	--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 <module>.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 <package>.<module> will be written to file <dir>/<package>/<module>.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�szmain.<locals>.parse_ignore_dircSs$g|]}|�d�D]}|���q	qS)�,)�split�strip)rr�rrrr
r�s

��zmain.<locals>.<listcomp>cs&g|]}|�tj�D]}�|��q
qSr)r�r�pathsep)rr�r�)r�rr
r�s
��z-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 --reportz3progname is missing: required with the main options)r�r�r�r�r;r<r�r�)r r��__package__�
__loader__�__spec__�
__cached__r4r�)r�r r�r�zCannot run file %r because: %s)0�argparse�ArgumentParser�add_argument�add_argument_group�add_mutually_exclusive_group�	REMAINDER�
parse_argsZ
ignore_dir�	sysconfigZget_pathZ
ignore_module�reportr6�errorrrt�missingrdre�anyr�rjZ	listfuncsZ
trackcallsr�rr��module�runpyZ_get_module_detailsr�r�r+�argv�parent�loaderrrrVr=r�r�r�rB�exit�
SystemExitr�Z	no_report)r��parser�grpZ_grpZoptsr��tr��module_nameZmod_nameZmod_specrZglobsrmrHr)r�r�r�r
�mainQs��
�
�
�
�

�
���
�
�
��
�
�
��
�

�
�




��	��$���rr�r#)�__all__r[rr+r�r�r^r�r�r~r>�timerr�r�rzrr(r3rr�r�r�rZrrr rrrr
�<module>s>20

O
�
© 2025 GrazzMean