AlkantarClanX12

Your IP : 18.224.54.61


Current Path : /opt/alt/python37/lib64/python3.7/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/__pycache__/pstats.cpython-37.opt-2.pyc

B

YI~d�j�@s�ddlZddlZddlZddlZddlZddlmZddlmZddgZ	Gdd�de
e�ZGdd�d�ZGdd	�d	�Z
d
d�Zdd
�Zdd�Zdd�Zdd�Zdd�Zdd�Zedk�r�ddlZyddlZWnek
r�YnXGdd�dej�Zeej�dk�rejdZndZyTee�Zx"ejdd�D]Ze� e��q.We!dej"d�e�#�e!dej"d�Wne$k
�r~YnXdS) �N)�Enum)�
cmp_to_key�Stats�SortKeyc@s8eZdZdZdZdZdZdZdZdZ	dZ
d	Zd
d�ZdS)
r)�calls�ncalls)�
cumulative�cumtime)�filename�module�line�name�nfl�pcalls�stdname)�time�tottimecGs>t�|�}|d|_x|dd�D]}||j|<q"W||_|S)Nr�)�str�__new__�_value_�_value2member_map_Z_all_values)�cls�values�objZother_value�r�+/opt/alt/python37/lib64/python3.7/pstats.pyr-s

zSortKey.__new__N)
�__name__�
__module__�__qualname__ZCALLSZ
CUMULATIVEZFILENAMEZLINE�NAMEZNFLZPCALLSZSTDNAMEZTIMErrrrrr"sc@s�eZdZdd�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.�Zd6d0d1�Zd2d3�Zd4d5�ZdS)7rN)�streamcGsF|ptj|_t|�sd}n|d}|dd�}|�|�|j|�dS)Nrr)�sys�stdoutr!�len�init�add)�selfr!�args�argrrr�__init__Ys
zStats.__init__cCs�d|_g|_d|_d|_d|_d|_d|_t�|_i|_	i|_
|�|�y|��Wn8t
k
r�td|jrx|jdnd|jd��YnXdS)NrzInvalid timing data %s����)�file)�all_callees�files�fcn_list�total_tt�total_calls�
prim_calls�max_name_len�set�	top_level�stats�
sort_arg_dict�
load_stats�get_top_level_stats�	Exception�printr!)r'r)rrrr%cs"
z
Stats.initc	Cs�|dkri|_dSt|t�rxt|d��}t�|�|_WdQRXy"t�|�}t�	|j
�d|}WnYnX|g|_n t|d�r�|�
�|j|_i|_|js�td|j|f��dS)N�rbz    �create_statsz.Cannot create or construct a %r object from %r)r7�
isinstancer�open�marshal�load�os�statrZctime�st_mtimer/�hasattrr>�	TypeError�	__class__)r'r)�fZ
file_statsrrrr9vs(



zStats.load_statscCs�x~|j��D]p\}\}}}}}|j|7_|j|7_|j|7_d|kr\|j�|�tt|��|j	krtt|��|_	qWdS)N)ZjprofilerZprofiler)
r7�itemsr2r3r1r6r&r$�func_std_stringr4)r'�func�cc�nc�tt�ct�callersrrrr:�szStats.get_top_level_statscGs�|s|Sx�t|�D]�}t|�t|�kr.t|�}|j|j7_|j|j7_|j|j7_|j|j7_x|jD]}|j�|�qvW|j	|j	kr�|j	|_	d|_
xJ|j��D]<\}}||jkr�|j|}nddddif}t
||�|j|<q�WqW|S)Nr)�reversed�typerr/r2r3r1r6r&r4r0r7rJ�add_func_stats)r'�arg_list�itemrLrDZ
old_func_statrrrr&�s(
z	Stats.addc	Cs(t|d��}t�|j|�WdQRXdS)N�wb)r@rA�dumpr7)r'r
rIrrr�
dump_stats�szStats.dump_stats)))rr+z
call count)))�r+zcumulative time)))�rz	file name)))�rzline number)))�rz
function name)))r]r)r[r)r\rzname/file/line)))rr+zprimitive call count)))�rz
standard name)))�r+z
internal time)
rrr	rr
rrr
rrrrrcCs�|jszi|_}i}xP|j��D]B\}}|}x4|r`|s8P||krJd||<P|||<|dd�}q.Wq Wx|D]
}||=qlW|jS)Nrr+)r8�sort_arg_dict_defaultrJ)r'�dictZbad_list�word�tupZfragmentrrr�get_sort_arg_defs�s 


zStats.get_sort_arg_defscGsl|sd|_|St|�dkrBt|dt�rBddddd�|dg}n>t|�dkr�x0|dd�D] }t|�t|d�kr\td	��q\W|��}d
}d|_d}xJ|D]B}t|t�r�|j	}|||d}|j|||d7_d}q�Wg}xB|j
��D]4\}\}	}
}}}
|�|	|
||f|t
|�|f�q�W|jtt|�j�d
�g|_}x|D]}|�|d��qPW|S)Nrrrrrr)r+rrr_r_zCan't have mixed argument typerr,z, )�keyr+)r0r$r?�intrSrGrd�	sort_typer�valuer7rJ�appendrK�sortr�	TupleComp�compare)r'Zfieldr)Z
sort_arg_defsZ
sort_tupleZ	connectorrbZ
stats_listrLrMrNrOrPrQr0�tuplerrr�
sort_stats�s>



zStats.sort_statscCs|jr|j��|S)N)r0�reverse)r'rrr�
reverse_orders
zStats.reverse_ordercCs�|j}i|_}d}x�|��D]�\}\}}}}}	t|�}
tt|
��|krTtt|
��}i}x |	��D]\}}
|
|t|�<qbW|
|kr�t||
|||||f�||
<q|||||f||
<qW|j}t�|_}x|D]}|�t|��q�W||_	d|_
d|_|S)Nr)r7rJ�func_strip_pathr$rKrTr6r5r&r4r0r.)r'ZoldstatsZnewstatsr4rLrMrNrOrPrQZnewfuncZ
newcallers�func2�callerZold_topZnew_toprrr�
strip_dirss.

zStats.strip_dirsc
Cs||jr
dSi|_}xb|j��D]T\}\}}}}}||krBi||<x0|��D]$\}}	||krdi||<|	|||<qLWq WdS)N)r.r7rJ)
r'r.rLrMrNrOrPrQrrrsrrr�calc_callees#s
zStats.calc_calleescCs|}t|t�rpyt�|�}Wn&tjk
rB|d|7}||fSXg}x�|D]}|�t|��rN|�|�qNWnzt|�}t|t	�r�d|kr�dkr�nnt
||d�}|d|�}n2t|t
�r�d|kr�|kr�nn|}|d|�}t|�t|�k�r|dt|�t|�|f7}||fS)Nz#   <Invalid regular expression %r>
gg�?g�?rz6   List reduced from %r to %r due to restriction <%r>
)r?r�re�compile�error�searchrKrir$�floatrf)r'Zsel�list�msgZnew_listZrexrL�countrrr�eval_print_amount6s,


""zStats.eval_print_amountcCs�|j}|jr*|jdd�}d|jd}nt|j���}d}x|D]}|�|||�\}}qBWt|�}|spd|fSt||j	d�|t|j�kr�d}x(|D] }tt
|��|kr�tt
|��}q�W|d|fS)Nz   Ordered by: �
z!   Random listing order was used
r)r-r_)r4r0rgr{r7�keysr~r$r<r!rK)r'Zsel_list�widthZ	stat_listr|Z	selectionr}rLrrr�get_print_listPs$

zStats.get_print_listcGs�x|jD]}t||jd�qW|jr0t|jd�d}x"|jD]}t|t|�|jd�q<Wt||jdd|jd�|j|jkr�td|jd|jd�td|j|jd�t|jd�|�|�\}}|r�|�	�x|D]}|�
|�q�Wt|jd�t|jd�|S)N)r-z        zfunction calls� )�endr-z(%d primitive calls)zin %.3f seconds)r/r<r!r6�func_get_function_namer2r3r1r��print_title�
print_line)r'�amountr
�indentrLr�r{rrr�print_statshs(
zStats.print_statscGs~|�|�\}}|rz|��|�|d�x:|D]2}||jkrP|�|||j|�q,|�||i�q,Wt|jd�t|jd�|S)Nz	called...)r-)r�ru�print_call_headingr.�print_call_liner<r!)r'r�r�r{rLrrr�
print_calleess

zStats.print_calleesc
Gsl|�|�\}}|rh|�|d�x0|D](}|j|\}}}}}	|�|||	d�q$Wt|jd�t|jd�|S)Nzwas called by...z<-)r-)r�r�r7r�r<r!)
r'r�r�r{rLrMrNrOrPrQrrr�
print_callers�s
zStats.print_callersc
Csxtd�|�||jd�d}x<|j��D].\}}}}}|r(tt|����}	t|	t�}Pq(W|rttd|d|jd�dS)Nz	Function )r-Fr�z    ncalls  tottime  cumtime)	r<�ljustr!r7r�next�iterr?rm)
r'�	name_sizeZcolumn_titleZ	subheaderrMrNrOrPrQrhrrrr��s
zStats.print_call_heading�->cCstt|��|�|d|jd�|s2t|jd�dSt|���}d}x�|D]�}t|�}||}	t|	t�r�|	\}
}}}
|
|kr�d|
|f}n
d|
f}d|�dd	t	|��t
|�t
|
�|f}|d
}n$d||	t
|j|d�f}|d}t||||jd�d}qHWdS)
Nr�)r�r-)r-r,z%d/%dz%dz%s %s %s  %sr^r_rz	%s(%r) %srZ)r<rKr�r!�sortedr�r?rm�rjustr$�f8r7)r'r��sourceZ	call_dictZarrowZclistr�rLr
rhrNrMrOrPZsubstatsZ
left_widthrrrr��s*



zStats.print_call_linecCs"tdd|jd�td|jd�dS)Nz-   ncalls  tottime  percall  cumtime  percallr�)r�r-zfilename:lineno(function))r-)r<r!)r'rrrr��szStats.print_titlecCs�|j|\}}}}}t|�}||kr4|dt|�}t|�d�d|jd�tt|�d|jd�|dkrxtdd|jd�ntt||�d|jd�tt|�d|jd�|dkr�tdd|jd�ntt||�d|jd�tt|�|jd�dS)N�/�	r�)r�r-rz        )r-)r7rr<r�r!r�rK)r'rLrMrNrOrPrQ�crrrr��szStats.print_line)r�)rrrr*r%r9r:r&rYr`rdrnrprtrur~r�r�r�r�r�r�r�r�rrrrr7sB"

'
c@seZdZdd�Zdd�ZdS)rkcCs
||_dS)N)�comp_select_list)r'r�rrrr*�szTupleComp.__init__cCsBx<|jD]2\}}||}||}||kr.|S||kr|SqWdS)Nr)r�)r'�left�right�index�	direction�l�rrrrrl�szTupleComp.compareN)rrrr*rlrrrrrk�srkcCs|\}}}tj�|�||fS)N)rC�path�basename)�	func_namer
rr
rrrrq�s
rqcCs|dS)Nr_r)rLrrrr��sr�cCsN|dd�dkrB|d}|�d�r<|�d�r<d|dd�S|Snd|SdS)	Nr_)�~r�<�>z{%s}rr+z	%s:%d(%s))�
startswith�endswith)r�r
rrrrK�srKcCs@|\}}}}}|\}}}	}
}||||||	||
t||�fS)N)�add_callers)�targetr�rMrNrOrPrQZt_ccZt_ncZt_ttZt_ctZ	t_callersrrrrTsrTcCs�i}x|��D]\}}|||<qWxb|��D]V\}}||krzt|t�rhtdd�t|||�D��||<q�|||7<q,|||<q,W|S)Ncss|]\}}||VqdS)Nr)�.0�i�jrrr�	<genexpr>szadd_callers.<locals>.<genexpr>)rJr?rm�zip)r�r�Znew_callersrLrsrrrr�s
"r�cCs"d}x|��D]}||7}qW|S)Nr)r)rQrNrrrr�count_callssr�cCsd|S)Nz%8.3fr)�xrrrr�(sr��__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�ProfileBrowserNcCs6tj�|�d|_d|_tj|_|dk	r2|�|�dS)Nz% )	�cmd�Cmdr*�promptr7r"r#r!�do_read)r'�profilerrrr*7szProfileBrowser.__init__c	Cs�|��}g}x�|D]�}y|�t|��wWntk
r>YnXy8t|�}|dksZ|dkrjtd|jd�w|�|�wWntk
r�YnX|�|�qW|jr�t|j|�|�ntd|jd�dS)Nrrz#Fraction argument must be in [0, 1])r-zNo statistics object is loaded.)	�splitrirf�
ValueErrorrzr<r!r7�getattr)r'�fnrr(Z	processedZtermZfracrrr�generic?s,

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'rrr�generic_helpWszProfileBrowser.generic_helpc
Csd|jrRy|j�|�Wq`tk
rN}ztd||f|jd�Wdd}~XYq`Xntd|jd�dS)Nz$Failed to load statistics for %s: %s)r-zNo statistics object is loaded.r)r7r&�OSErrorr<r!)r'r�errr�do_add_s*zProfileBrowser.do_addcCstd|jd�dS)Nz>Add profile info from given file to current statistics object.)r-)r<r!)r'rrr�help_addhszProfileBrowser.help_addcCs|�d|�S)Nr�)r�)r'rrrr�
do_calleeskszProfileBrowser.do_calleescCstd|jd�|��dS)Nz6Print callees statistics from the current stat object.)r-)r<r!r�)r'rrr�help_calleesmszProfileBrowser.help_calleescCs|�d|�S)Nr�)r�)r'rrrr�
do_callersqszProfileBrowser.do_callerscCstd|jd�|��dS)Nz6Print callers statistics from the current stat object.)r-)r<r!r�)r'rrr�help_callerssszProfileBrowser.help_callerscCstd|jd�dS)Nr,)r-r)r<r!)r'rrrr�do_EOFwszProfileBrowser.do_EOFcCstd|jd�dS)NzLeave the profile brower.)r-)r<r!)r'rrr�help_EOFzszProfileBrowser.help_EOFcCsdS)Nrr)r'rrrr�do_quit}szProfileBrowser.do_quitcCstd|jd�dS)NzLeave the profile brower.)r-)r<r!)r'rrr�	help_quitszProfileBrowser.help_quitc
Cs�|r�yt|�|_Wnntk
rH}zt|jd|jd�dSd}~XYn:tk
r�}zt|jjd||jd�dSd}~XYnX|d|_	n6t
|j	�dkr�|j	dd�}|�|�ntd|jd�dS)	Nr)r-�:z% r_���z1No statistics object is current -- cannot reload.r)rr7r�r<r(r!r;rHrr�r$r�)r'r�errrrrr��szProfileBrowser.do_readcCs 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'rrr�	help_read�szProfileBrowser.help_readcCs$|jr|j��ntd|jd�dS)NzNo statistics object is loaded.)r-r)r7rpr<r!)r'rrrr�
do_reverse�szProfileBrowser.do_reversecCstd|jd�dS)Nz/Reverse the sort order of the profiling report.)r-)r<r!)r'rrr�help_reverse�szProfileBrowser.help_reversecs�|jstd|jd�dS|j���|rRt�fdd�|��D��rR|jj|���n@td|jd�x0tj�	�D]"\}}td||df|jd�qlWdS)	NzNo statistics object is loaded.)r-c3s|]}|�kVqdS)Nr)r�r�)�abbrevsrrr��sz)ProfileBrowser.do_sort.<locals>.<genexpr>z/Valid sort keys (unique prefixes are accepted):z%s -- %srr)
r7r<r!rd�allr�rnrr`rJ)r'rrerhr)r�r�do_sort�s
zProfileBrowser.do_sortcCs td|jd�td|jd�dS)Nz.Sort profile data according to specified keys.)r-z3(Typing `sort' without arguments lists valid keys.))r<r!)r'rrr�	help_sort�szProfileBrowser.help_sortcs�fdd�tjD�S)Ncsg|]}|���r|�qSr)r�)r��a)�textrr�
<listcomp>�sz0ProfileBrowser.complete_sort.<locals>.<listcomp>)rr`)r'r�r(r)r�r�
complete_sort�szProfileBrowser.complete_sortcCs|�d|�S)Nr�)r�)r'rrrr�do_stats�szProfileBrowser.do_statscCstd|jd�|��dS)Nz.Print statistics from the current stat object.)r-)r<r!r�)r'rrr�
help_stats�szProfileBrowser.help_statscCs$|jr|j��ntd|jd�dS)NzNo statistics object is loaded.)r-)r7rtr<r!)r'rrrr�do_strip�szProfileBrowser.do_stripcCstd|jd�dS)Nz<Strip leading path information from filenames in the report.)r-)r<r!)r'rrr�
help_strip�szProfileBrowser.help_stripcCstd|jd�dS)NzShow help for a given command.)r-)r<r!)r'rrr�	help_help�szProfileBrowser.help_helpcCs|r|SdS)Nr)r'�stoprrrr�postcmd�szProfileBrowser.postcmd)N)rrrr*r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr�6s4
	r�rr_z*Welcome to the profile statistics browser.)r-zGoodbye.)%r"rCrrArv�enumr�	functoolsr�__all__rrrrkrqr�rKrTr�r�r�rr��readline�ImportErrorr�r�r$�argvZinitprofileZbrowserr�r�r<r!Zcmdloop�KeyboardInterruptrrrr�<module>sP