Your IP : 18.222.98.91


Current Path : /opt/alt/python310/lib64/python3.10/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/__pycache__/pstats.cpython-310.opt-2.pyc

o

6��f�r�@s�	ddlZddlZddlZddlZddlZddlmZddlmZddl	m
Z
ddlmZgd�Z
Gdd�dee�Ze
d	d
�Gdd�d��Ze
d	d
�Gd
d�d��ZGdd�d�ZGdd�d�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zed!kr�ddlZzddlZWn	ey�YnwGd"d#�d#ej�Z e!ej"�d$kr�ej"d$Z#ndZ#z(e e#�Z$ej"d%d�D]Z%e$�&e%�q�e'd&e$j(d'�e$�)�e'd(e$j(d'�WdSe*y�YdSwdS))�N)�Enum)�
cmp_to_key)�	dataclass)�Dict)�Stats�SortKey�FunctionProfile�StatsProfilec@s8eZdZdZdZdZdZdZdZdZ	dZ
d	Zd
d�ZdS)
r)�calls�ncalls)�
cumulative�cumtime)�filename�module�line�name�nfl�pcalls�stdname)�time�tottimecGs@|d}t�||�}||_|dd�D]}||j|<q||_|S�Nr�)�str�__new__�_value_�_value2member_map_Z_all_values)�cls�values�value�objZother_value�r!�-/opt/alt/python310/lib64/python3.10/pstats.pyr/szSortKey.__new__N)
�__name__�
__module__�__qualname__ZCALLSZ
CUMULATIVEZFILENAMEZLINE�NAMEZNFLZPCALLSZSTDNAMEZTIMErr!r!r!r"r$srT)Zunsafe_hashc@sFeZdZUeed<eed<eed<eed<eed<eed<eed<dS)	rrr�percall_tottimer
�percall_cumtime�	file_name�line_numberN)r#r$r%r�__annotations__�float�intr!r!r!r"r9s
rc@s(eZdZU	eed<eeefed<dS)r	�total_tt�
func_profilesN)r#r$r%r,r+rrrr!r!r!r"r	Cs
r	c@s�eZdZ	dd�dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Zdddddddddddddd�
Z	dd�Z
dd�Zdd�Zdd �Z
d!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd8d2d3�Zd4d5�Zd6d7�ZdS)9rN)�streamcGsF|ptj|_t|�s
d}n
|d}|dd�}|�|�|j|�dSr)�sys�stdoutr0�len�init�add)�selfr0�args�argr!r!r"�__init__ks
zStats.__init__cCs�d|_g|_d|_d|_d|_d|_d|_t�|_i|_	i|_
|�|�z|��WdSt
yDtd|jr<|jdnd|jd��w)NrzInvalid timing data %s������file)�all_callees�files�fcn_listr.�total_calls�
prim_calls�max_name_len�set�	top_level�stats�
sort_arg_dict�
load_stats�get_top_level_stats�	Exception�printr0)r6r8r!r!r"r4us*
���z
Stats.initcCs�|dur	i|_dSt|t�rDt|d��}t�|�|_Wd�n1s$wYzt�|�}t�	|j
�d|}WnY|g|_nt|d�rT|�
�|j|_i|_|js`td|j|f��dS)N�rbz    �create_statsz.Cannot create or construct a %r object from %r)rF�
isinstancer�open�marshal�load�os�statr�ctime�st_mtimer?�hasattrrM�	TypeError�	__class__)r6r8�fZ
file_statsr!r!r"rH�s,
�


�zStats.load_statscCs�|j��D]8\}\}}}}}|j|7_|j|7_|j|7_d|vr-|j�|�tt|��|j	kr=tt|��|_	qdS)N)ZjprofilerZprofiler)
rF�itemsrArBr.rEr5r3�func_std_stringrC)r6�func�cc�nc�tt�ct�callersr!r!r"rI�s��zStats.get_top_level_statscGs�|s|St|�D]k}t|�t|�krt|�}|j|j7_|j|j7_|j|j7_|j|j7_|jD]}|j�|�q9|j	|j	krL|j	|_	d|_
|j��D]\}}||jvrc|j|}nddddif}t
||�|j|<qTq|S�Nr)�reversed�typerr?rArBr.rEr5rCr@rFrZ�add_func_stats)r6�arg_list�itemr\rSZ
old_func_statr!r!r"r5�s*

�z	Stats.addcCs@	t|d��}t�|j|�Wd�dS1swYdS)N�wb)rOrP�dumprF)r6rrYr!r!r"�
dump_stats�s"�zStats.dump_stats)))rr:z
call count)))�r:zcumulative time))��rz	file name))��rzline number))��rz
function name))rprlrnzname/file/line)))rr:zprimitive call count)))�rz
standard name)))�r:z
internal time)
r
rr
rrrrrrrrrrcCsx	|js9i|_}i}|j��D] \}}|}|r0|sn||vr$d||<n|||<|dd�}|sq|D]}||=q3|jS)Nrr:)rG�sort_arg_dict_defaultrZ)r6�dictZbad_list�word�tupZfragmentr!r!r"�get_sort_arg_defs�s&
��zStats.get_sort_arg_defscGsZ|sd|_|St|�dkr!t|dt�r!ddddd�|dg}nt|�dkr>|dd�D]}t|�t|d�kr=td	��q-|��}d
}d|_d}|D]!}t|t�rU|j	}|||d}|j|||d7_d}qKg}|j
��D]\}\}	}
}}}
|�|	|
||f|t
|�|f�qt|jtt|�j�d
�g|_}|D]	}|�|d�q�|S)Nrrrr
rr)r:rrrsrszCan't have mixed argument typer!r;z, )�keyr:)r@r3rNr-rdrWrx�	sort_typerrrFrZ�appendr[�sortr�	TupleComp�compare)r6Zfieldr8Z
sort_arg_defsZ
sort_tupleZ	connectorrvZ
stats_listr\r]r^r_r`rar@�tupler!r!r"�
sort_stats�sH���

�
zStats.sort_statscCs|jr|j��|S�N)r@�reverse�r6r!r!r"�
reverse_orders
zStats.reverse_ordercCs�|j}i|_}d}|��D]H\}\}}}}}	t|�}
tt|
��|kr)tt|
��}i}|	��D]
\}}
|
|t|�<q/|
|vrMt||
|||||f�||
<q|||||f||
<q|j}t�|_}|D]	}|�t|��qb||_	d|_
d|_|Srb)rFrZ�func_strip_pathr3r[rerErDr5rCr@r>)r6ZoldstatsZnewstatsrCr\r]r^r_r`raZnewfuncZ
newcallers�func2�callerZold_topZnew_topr!r!r"�
strip_dirss0

�zStats.strip_dirsc
Cst|jrdSi|_}|j��D](\}\}}}}}||vr i||<|��D]\}}	||vr0i||<|	|||<q$qdSr�)r>rFrZ)
r6r>r\r]r^r_r`rar�r�r!r!r"�calc_callees5s
�zStats.calc_calleescCs|}t|t�r7zt�|�}Wntjy"|d|7}||fYSwg}|D]}|�t|��r5|�|�q'n=t|�}t|t	�r[d|krJdkr[nnt
||d�}|d|�}nt|t
�rtd|krj|krtnn|}|d|�}t|�t|�kr�|dt|�t|�|f7}||fS)Nz#   <Invalid regular expression %r>
gg�?g�?rz6   List reduced from %r to %r due to restriction <%r>
)rNr�re�compile�error�searchr[r{r3r,r-)r6Zsel�list�msgZnew_listZrexr\�countr!r!r"�eval_print_amountHs4
�
��""�zStats.eval_print_amountc	Cs
	|jr|jdd�nt|j���}|stdi�Stt|j��}i}t||�}|D]Y}|j|\}}}}	}
|\}}}
||krBt|�n	t|�dt|�}tt|��}|dkrXdntt||��}tt|	��}|dkrldntt|	|��}t	|||||||�}|||
<q)|S)Nr�/r:)
r@r�rF�keysr	r,�f8r.rr)r6Z	func_listr.r/Z
stats_profiler\r]r^r_r`rar)r*�	func_namerrr'r
r(Zfunc_profiler!r!r"�get_stats_profilebs4"


$�
	zStats.get_stats_profilecCs�|j}|jr|jdd�}d|jd}n	t|j���}d}|D]}|�|||�\}}q t|�}|s6d|fSt||j	d�|t|j�krYd}|D]}tt
|��|krXtt
|��}qH|d|fS)Nz   Ordered by: �
z!   Random listing order was used
rr<rs)rCr@rzr�rFr�r�r3rKr0r[)r6Zsel_list�widthZ	stat_listr�Z	selectionr�r\r!r!r"�get_print_list�s&�zStats.get_print_listcGs�|jD]	}t||jd�q|jrt|jd�d}|jD]}t|t|�|jd�qt||jdd|jd�|j|jkrDtd|jd|jd�td|j|jd�t|jd�|�|�\}}|rw|�	�|D]}|�
|�qct|jd�t|jd�|S)Nr<�        zfunction calls� ��endr=z(%d primitive calls)zin %.3f seconds)r?rKr0rE�func_get_function_namerArBr.r��print_title�
print_line)r6�amountr�indentr\r�r�r!r!r"�print_stats�s(

zStats.print_statscGsz|�|�\}}|r;|��|�|d�|D]}||jvr'|�|||j|�q|�||i�qt|jd�t|jd�|S)Nz	called...r<)r�r��print_call_headingr>�print_call_linerKr0)r6r�r�r�r\r!r!r"�
print_callees�s
zStats.print_calleesc
Gsh|�|�\}}|r2|�|d�|D]}|j|\}}}}}	|�|||	d�qt|jd�t|jd�|S)Nzwas called by...z<-r<)r�r�rFr�rKr0)
r6r�r�r�r\r]r^r_r`rar!r!r"�
print_callers�szStats.print_callersc
Csztd�|�||jd�d}|j��D]\}}}}}|r+tt|����}	t|	t�}nq|r;td|d|jd�dSdS)Nz	Function r<Fr�z    ncalls  tottime  cumtime)	rK�ljustr0rFr�next�iterrNr)
r6�	name_sizeZcolumn_titleZ	subheaderr]r^r_r`rarr!r!r"r��s
��zStats.print_call_heading�->cCstt|��|�|d|jd�|st|jd�dSt|���}d}|D]^}t|�}||}	t|	t�rb|	\}
}}}
|
|krCd|
|f}nd|
f}d|�dd	t	|��t
|�t
|
�|f}|d
}nd||	t
|j|d�f}|d}t||||jd�d}q#dS)
Nr�r�r<r;z%d/%dz%dz%s %s %s  %srrrsrz	%s(%r) %srk)rKr[r�r0�sortedr�rNr�rjustr3r�rF)r6r��sourceZ	call_dictZarrowZclistr�r\rrr^r]r_r`ZsubstatsZ
left_widthr!r!r"r��s.

�
�zStats.print_call_linecCs"tdd|jd�td|jd�dS)Nz-   ncalls  tottime  percall  cumtime  percallr�r�zfilename:lineno(function)r<�rKr0r�r!r!r"r��szStats.print_titlecCs�|j|\}}}}}t|�}||kr|dt|�}t|�d�d|jd�tt|�d|jd�|dkr<tdd|jd�ntt||�d|jd�tt|�d|jd�|dkr_tdd|jd�ntt||�d|jd�tt|�|jd�dS)Nr��	r�r�rr�r<)rFrrKr�r0r�r[)r6r\r]r^r_r`ra�cr!r!r"r��szStats.print_line)r�)r#r$r%r9r4rHrIr5rjrtrxr�r�r�r�r�r�r�r�r�r�r�r�r�r�r!r!r!r"rIsJ!

�'#
rc@seZdZ	dd�Zdd�ZdS)r}cCs
||_dSr���comp_select_list)r6r�r!r!r"r9s
zTupleComp.__init__cCsF|jD]\}}||}||}||kr|S||kr |SqdSrbr�)r6�left�right�indexZ	direction�l�rr!r!r"r~s
�zTupleComp.compareN)r#r$r%r9r~r!r!r!r"r}	sr}cCs|\}}}tj�|�||fSr�)rR�path�basename)r�rrrr!r!r"r�"s
r�cCs|dS)Nrsr!)r\r!r!r"r�&�r�cCsH|dd�dkr |d}|�d�r|�d�rd|dd�S|Sd|S)	Nrs)�~r�<�>z{%s}rr:z	%s:%d(%s))�
startswith�endswith)r�rr!r!r"r[)sr[cCsB	|\}}}}}|\}}}	}
}||||||	||
t||�fSr�)�add_callers)�targetr�r]r^r_r`raZt_ccZt_ncZt_ttZt_ctZ	t_callersr!r!r"re:s�recCs�	i}|��D]\}}|||<q|��D]+\}}||vr;t|t�r2tdd�t|||�D��||<q|||7<q|||<q|S)Ncss�|]	\}}||VqdSr�r!)�.0�i�jr!r!r"�	<genexpr>Js�zadd_callers.<locals>.<genexpr>)rZrNr�zip)r�r�Znew_callersr\r�r!r!r"r�As

"
r�cCs 	d}|��D]}||7}q|Srb)r)rar^r
r!r!r"�count_callsRs

r�cCsd|S)Nz%8.3fr!)�xr!r!r"r�]r�r��__main__c@s�eZdZd6dd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�ZdS)7�ProfileBrowserNcCs:tj�|�d|_d|_tj|_|dur|�|�dSdS)N�% )	�cmd�Cmdr9�promptrFr1r2r0�do_read)r6�profiler!r!r"r9ls�zProfileBrowser.__init__c	Cs�|��}g}|D]@}z	|�t|��WqtyYnwzt|�}|dks*|dkr3td|jd�Wq|�|�WqtyBYnw|�|�q|jrVt|j|�|�dStd|jd�dS)Nrrz#Fraction argument must be in [0, 1]r<�No statistics object is loaded.)	�splitr{r-�
ValueErrorr,rKr0rF�getattr)r6�fnrr7Z	processedZtermZfracr!r!r"�genericts2�
��zProfileBrowser.genericcCsXtd|jd�td|jd�td|jd�td|jd�td|jd�td|jd�dS)NzArguments may be:r<z0* An integer maximum number of entries to print.z:* A decimal fractional number between 0 and 1, controllingz-  what fraction of selected entries to print.z8* A regular expression; only entries with function namesz  that match it are printed.r�r�r!r!r"�generic_help�szProfileBrowser.generic_helpc
Csh|jr+z	|j�|�WdSty*}ztd||f|jd�WYd}~dSd}~wwtd|jd�dS)Nz$Failed to load statistics for %s: %sr<r�r)rFr5�OSErrorrKr0)r6r�er!r!r"�do_add�s� ��zProfileBrowser.do_addcC�td|jd�dS)Nz>Add profile info from given file to current statistics object.r<r�r�r!r!r"�help_add��zProfileBrowser.help_addcC�|�d|�S)Nr��r��r6rr!r!r"�
do_callees��zProfileBrowser.do_calleescC�td|jd�|��dS)Nz6Print callees statistics from the current stat object.r<�rKr0r�r�r!r!r"�help_callees��zProfileBrowser.help_calleescCr�)Nr�r�r�r!r!r"�
do_callers�r�zProfileBrowser.do_callerscCr�)Nz6Print callers statistics from the current stat object.r<r�r�r!r!r"�help_callers�r�zProfileBrowser.help_callerscCstd|jd�dS)Nr;r<rr�r�r!r!r"�do_EOF�szProfileBrowser.do_EOFcCr��NzLeave the profile browser.r<r�r�r!r!r"�help_EOF�r�zProfileBrowser.help_EOFcCsdS)Nrr!r�r!r!r"�do_quit�szProfileBrowser.do_quitcCr�r�r�r�r!r!r"�	help_quit�r�zProfileBrowser.help_quitc
Cs�|rLzt|�|_Wn;ty&}zt|jd|jd�WYd}~dSd}~wtyD}zt|jjd||jd�WYd}~dSd}~ww|d|_	dSt
|j	�dkra|j	dd�}|�|�dStd|jd�dS)	Nrr<�:r�rs���z1No statistics object is current -- cannot reload.r)rrFr�rKr7r0rJrXr#r�r3r�)r6r�errr!r!r"r��s(���
�
�zProfileBrowser.do_readcC� td|jd�td|jd�dS)Nz+Read in profile data from a specified file.r<z*Without argument, reload the current file.r�r�r!r!r"�	help_read��zProfileBrowser.help_readcCs&|jr
|j��dStd|jd�dS)Nr�r<r)rFr�rKr0r�r!r!r"�
do_reverse�s

�zProfileBrowser.do_reversecCr�)Nz/Reverse the sort order of the profiling report.r<r�r�r!r!r"�help_reverse�r�zProfileBrowser.help_reversecs�|jstd|jd�dS|j���|r*t�fdd�|��D��r*|jj|���dStd|jd�tj�	�D]\}}td||df|jd�q6dS)	Nr�r<c3s�|]}|�vVqdSr�r!)r�r��Zabbrevsr!r"r��s�z)ProfileBrowser.do_sort.<locals>.<genexpr>z/Valid sort keys (unique prefixes are accepted):z%s -- %srr)
rFrKr0rx�allr�r�rrtrZ)r6rryrr!r�r"�do_sort�s
�zProfileBrowser.do_sortcCr�)Nz.Sort profile data according to specified keys.r<z3(Typing `sort' without arguments lists valid keys.)r�r�r!r!r"�	help_sort�r�zProfileBrowser.help_sortcs�fdd�tjD�S)Ncsg|]	}|���r|�qSr!)r�)r��a��textr!r"�
<listcomp>�sz0ProfileBrowser.complete_sort.<locals>.<listcomp>)rrt)r6r�r7r!r�r"�
complete_sort�szProfileBrowser.complete_sortcCr�)Nr�r�r�r!r!r"�do_stats�r�zProfileBrowser.do_statscCr�)Nz.Print statistics from the current stat object.r<r�r�r!r!r"�
help_stats�r�zProfileBrowser.help_statscCs&|jr
|j��dStd|jd�dS)Nr�r<)rFr�rKr0r�r!r!r"�do_strip�szProfileBrowser.do_stripcCr�)Nz<Strip leading path information from filenames in the report.r<r�r�r!r!r"�
help_strip�r�zProfileBrowser.help_stripcCr�)NzShow help for a given command.r<r�r�r!r!r"�	help_help�r�zProfileBrowser.help_helpcCs|r|SdSr�r!)r6�stoprr!r!r"�postcmd�szProfileBrowser.postcmdr�)r#r$r%r9r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrrrr!r!r!r"r�ks6
	r�rrsz*Welcome to the profile statistics browser.r<zGoodbye.)+r1rRrrPr��enumr�	functoolsrZdataclassesr�typingr�__all__rrrr	rr}r�r�r[rer�r�r�r#r��readline�ImportErrorr�r�r3�argvZinitprofileZbrowserr�r�rKr0Zcmdloop�KeyboardInterruptr!r!r!r"�<module>sh	C����

?>