Hacked By AnonymousFox

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



���]�g�@s�ddlZddlZddlZddlZddlZddlmZdgZGdd�d�ZGdd�d�Z	dd�Z
d	d
�Zdd�Zd
d�Z
dd�Zdd�Zdd�Zedkr�ddlZyddlZWnek
rYnXGdd�dej�Zeej�dkrJejdZndZykee�Zx(ejdd�D]Zeje�qsWeddej�ej�eddej�Wne k
r�YnXdS)�N)�
cmp_to_key�Statsc@sceZdZdddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�ZddNddRddVddZdd]dd`ddcddfddid"dnd$drd'dud*dyd-d}iZ	d.d/�Z
d0d1�Zd2d3�Zd4d5�Z
d6d7�Zd8d9�Zd:d;�Zd<d=�Zd>d?�Zd@dA�ZdBdC�ZdDdEdF�ZdGdH�ZdIdJ�ZdS)~r�streamNcGs_|ptj|_t|�s'd}n|d}|dd�}|j|�|j|�dS)Nr�)�sys�stdoutr�len�init�add)�selfr�args�arg�r�+/opt/alt/python35/lib64/python3.5/pstats.py�__init__As	

zStats.__init__cCs�d|_g|_d|_d|_d|_d|_d|_t�|_i|_	i|_
|j|�y|j�WnBt
k
r�td|jr�|jdndd|j��YnXdS)NrzInvalid timing data %sr��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)rr
rrrr	Ks"									

'z
Stats.initcCs�|dkri|_dSt|t�r�t|d��}tj|�|_WdQRXy-tj|�}tj	|j
�d|}WnYnX|g|_n.t|d�r�|j
�|j|_i|_|js�td|j|f��dS)N�rbz    �create_statsz.Cannot create or construct a %r object from %r)r�
isinstance�str�open�marshal�load�os�stat�time�ctime�st_mtimer�hasattrr$�	TypeError�	__class__)rr
�fZ
file_statsrrrr^s(	
		zStats.load_statscCs�x�|jj�D]�\}\}}}}}|j|7_|j|7_|j|7_d|krt|jj|�tt|��|j	krtt|��|_	qWdS)N�jprofiler�profiler)r3rr4)
r�itemsrrrrr
r�func_std_stringr)r�func�cc�nc�tt�ct�callersrrrr ts+zStats.get_top_level_statscGsF|s
|Sx5t|�D]'}t|�t|�krAt|�}|j|j7_|j|j7_|j|j7_|j|j7_x!|jD]}|jj|�q�W|j	|j	kr�|j	|_	d|_
xg|jj�D]V\}}||jkr|j|}nddddif}t
||�|j|<q�WqW|S)Nr)�reversed�typerrrrrrr
rrrr5�add_func_stats)r�arg_list�itemr7r+Z
old_func_statrrrr
~s(	z	Stats.addc
Cs0t|d��}tj|j|�WdQRXdS)N�wb)r'r(�dumpr)r�filenamer2rrr�
dump_stats�szStats.dump_stats�callsr�
call countZncallsZcumtime��cumulative time�
cumulativer��	file namerD�line��line number�module�name��
function nameZnfl�name/file/lineZpcallsr�primitive call count�stdname��
standard namer,��
internal timeZtottimecCs�|js�i|_}i}xh|jj�D]W\}}|}xB|r�|sNP||kred||<P|||<|dd�}qAWq,Wx|D]
}||=q�W|jS)Nrrr)r�sort_arg_dict_defaultr5)r�dictZbad_list�word�tupZfragmentrrr�get_sort_arg_defs�s 	
	


zStats.get_sort_arg_defscGsz|sd|_|St|�dkrat|dt�raddddddddi|dg}|j�}f}d|_d}xA|D]9}|||d}|j|||d7_d	}q�Wg}xY|jj�D]H\}\}}	}
}}|j||	|
|f|t	|�|f�q�W|j
d
tt|�j
��g|_}
x|D]}|
j|d�q[W|S)
NrrrVrFr,rYrJrz, �keyrr)rrr%�intr_�	sort_typerr5�appendr6�sortr�	TupleComp�compare)rZfieldZ
sort_arg_defsZ
sort_tupleZ	connectorr]Z
stats_listr7r8r9r:r;r<r�tuplerrr�
sort_stats�s2	%	

+

zStats.sort_statscCs|jr|jj�|S)N)r�reverse)rrrr�
reverse_order�s	
zStats.reverse_ordercCs[|j}i|_}d}x�|j�D]�\}\}}}}}	t|�}
tt|
��|krztt|
��}i}x*|	j�D]\}}
|
|t|�<q�W|
|kr�t||
|||||f�||
<q)|||||f||
<q)W|j}t�|_}x!|D]}|jt|��qW||_	d|_
d|_|S)Nr)rr5�func_strip_pathrr6r?rrr
rrr)rZoldstatsZnewstatsrr7r8r9r:r;r<ZnewfuncZ
newcallers�func2�callerZold_topZnew_toprrr�
strip_dirs�s.	
(	
			zStats.strip_dirsc
Cs�|jr
dSi|_}x�|jj�D]r\}\}}}}}||kr[i||<x>|j�D]0\}}	||kr�i||<|	|||<qhWq*WdS)N)rrr5)
rrr7r8r9r:r;r<rlrmrrr�calc_calleess	
+

zStats.calc_calleesc
Csx|}t|t�r�ytj|�}Wn-tjk
rW|d|7}||fSYnXg}x�|D](}|jt|��re|j|�qeWn�t|�}t|t	�r�d|ko�dknr�t
||d�}|d|�}nAt|t
�r3d|ko|knr3|}|d|�}t|�t|�krn|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�searchr6rcr�floatra)rZsel�list�msgZnew_listZrexr7�countrrr�eval_print_amounts,
++zStats.eval_print_amountcCs|j}|jr9|jdd�}d|jd}nt|jj��}d}x)|D]!}|j|||�\}}q[Wt|�}|s�d|fSt|d|j	�|t|j�krd}x8|D]0}tt
|��|kr�tt
|��}q�W|d|fS)Nz   Ordered by: �
z!   Random listing order was used
rrrY)rrrbrur�keysrxrr"rr6)rZsel_list�widthZ	stat_listrvZ	selectionrwr7rrr�get_print_list2s$		


zStats.get_print_listcGs[x$|jD]}t|d|j�q
W|jr@td|j�d}x-|jD]"}t|t|�d|j�qPWt||jdddd|j�|j|jkr�td|jddd|j�td|jd|j�td|j�|j|�\}}|rW|j	�x|D]}|j
|�q Wtd|j�td|j�|S)	Nr� �zfunction calls�endz(%d primitive calls)zin %.3f secondsz        )rr"rr�func_get_function_namerrrr|�print_title�
print_line)r�amountrD�indentr7r{rurrr�print_statsJs(	 " 

zStats.print_statscGs�|j|�\}}|r�|j�|j|d�xM|D]E}||jkrn|j|||j|�q<|j||i�q<Wtd|j�td|j�|S)Nz	called...r)r|ro�print_call_headingr�print_call_liner"r)rr�r{rur7rrr�
print_calleesas

zStats.print_calleesc
Gs�|j|�\}}|r�|j|d�x@|D]8}|j|\}}}}}	|j|||	d�q2Wtd|j�td|j�|S)Nzwas called by...z<-r)r|r�rr�r"r)
rr�r{rur7r8r9r:r;r<rrr�
print_callersps
zStats.print_callersc
Cs�tdj|�|d|j�d}xT|jj�D]C\}}}}}|r6tt|j���}	t|	t�}Pq6W|r�td|dd|j�dS)Nz	Function rFr}z    ncalls  tottime  cumtime)	r"�ljustrr�values�next�iterr%rg)
r�	name_sizeZcolumn_titleZ	subheaderr8r9r:r;r<�valuerrrr�{s %zStats.print_call_headingz->cCsktt|�j|�|ddd|j�|sFtd|j�dSt|j��}d}x|D]�}t|�}||}	t|	t�r|	\}
}}}
|
|kr�d|
|f}n
d|
f}d|jdd	t	|��t
|�t
|
�|f}|d
}n.d||	t
|j|d�f}|d}t|||d|j�d}qeWdS)
Nrr}rrz%d/%dz%dz%s %s %s  %srWrYrz	%s(%r) %srH)r"r6r�r�sortedrzr%rg�rjustr�f8r)rr��sourceZ	call_dictZarrowZclistr�r7rQr�r9r8r:r;ZsubstatsZ
left_widthrrrr��s*,



$
zStats.print_call_linecCs0tdddd|j�tdd|j�dS)Nz-   ncalls  tottime  percall  cumtime  percallrr}rzfilename:lineno(function))r"r)rrrrr��szStats.print_titlecCs[|j|\}}}}}t|�}||krH|dt|�}t|jd�ddd|j�tt|�ddd|j�|dkr�tdddd|j�n#tt||�ddd|j�tt|�ddd|j�|dkrtd	ddd|j�n#tt||�ddd|j�tt|�d|j�dS)
N�/�	rr}rrr~z        z        )rr&r"r�rr�r6)rr7r8r9r:r;r<�crrrr��s"##zStats.print_liner�rr�r�)r�rGr�rr�r�)r�rGr�rHr�r�)r�rIr�rHr�r�)r�rI�rKr�r�)r�rL�rKr�r�)r�rL�rNr�r�)r�rO�rKr�r�)r�rL�rRr�r�)r�rS�rRr�rKr�rNr�r�r�r�)r�rTr�rr�r�)r�rU�rWr�r�)r�rXr�rYr�r�)r�rZr�rYr�r�)r�rZ)�__name__�
__module__�__qualname__rr	rr r
rEr[r_rhrjrnrorxr|r�r�r�r�r�r�r�rrrrr sD!

 c@s(eZdZdd�Zdd�ZdS)recCs
||_dS)N)�comp_select_list)rr�rrrr�szTupleComp.__init__cCsSxL|jD]A\}}||}||}||kr;|S||kr
|Sq
WdS)Nr)r�)r�left�right�index�	direction�l�rrrrrf�s

zTupleComp.compareN)r�r�r�rrfrrrrre�srecCs(|\}}}tjj|�||fS)N)r*�path�basename)�	func_namerDrMrQrrrrk�srkcCs|dS)NrYr)r7rrrr��sr�cCsc|dd�d	krW|d}|jd�rP|jd�rPd|dd
�S|Snd|SdS)NrY�~r�<�>z{%s}rz	%s:%d(%s))r�rr)�
startswith�endswith)r�rQrrrr6�s
r6cCsV|\}}}}}|\}}}	}
}||||||	||
t||�fS)N)�add_callers)�targetr�r8r9r:r;r<Zt_ccZt_ncZt_ttZt_ctZ	t_callersrrrr?�sr?cCs�i}x$|j�D]\}}|||<qWx}|j�D]o\}}||kr�t|t�r�tdd�t|||�D��||<q�|||7<q:|||<q:W|S)NcSs"g|]}|d|d�qS)rrr)�.0�irrr�
<listcomp>�s	zadd_callers.<locals>.<listcomp>)r5r%rg�zip)r�r�Znew_callersr7rmrrrr��s!r�cCs+d}x|j�D]}||7}qW|S)Nr)r�)r<r9rFrrr�count_callssr�cCsd|S)Nz%8.3fr)�xrrrr�sr��__main__c@sKeZdZddd�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)6�ProfileBrowserNcCsKtjj|�d|_d|_tj|_|dk	rG|j|�dS)Nz% )	�cmd�Cmdr�promptrrrr�do_read)r�profilerrrrs		zProfileBrowser.__init__cCs�|j�}g}x�|D]�}y|jt|��wWntk
rMYnXyNt|�}|dksu|dkr�tdd|j�w|j|�wWntk
r�YnX|j|�qW|jr�t|j|�|�ntdd|j�dS)Nrrz#Fraction argument must be in [0, 1]rzNo statistics object is loaded.)	�splitrcra�
ValueErrorrtr"rr�getattr)r�fnrMrZ	processedZtermZfracrrr�generic"s,



	zProfileBrowser.genericcCsvtdd|j�tdd|j�tdd|j�tdd|j�tdd|j�tdd|j�dS)NzArguments may be:rz0* 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)rrrr�generic_help:szProfileBrowser.generic_helpcCs||jrey|jj|�Wqxtk
ra}z"td||fd|j�WYdd}~XqxXntdd|j�dS)Nz$Failed to load statistics for %s: %srzNo statistics object is loaded.r)rr
�IOErrorr"r)rrM�errr�do_addBs	3zProfileBrowser.do_addcCstdd|j�dS)Nz>Add profile info from given file to current statistics object.r)r"r)rrrr�help_addKszProfileBrowser.help_addcCs|jd|�S)Nr�)r�)rrMrrr�
do_calleesNszProfileBrowser.do_calleescCs!tdd|j�|j�dS)Nz6Print callees statistics from the current stat object.r)r"rr�)rrrr�help_calleesPszProfileBrowser.help_calleescCs|jd|�S)Nr�)r�)rrMrrr�
do_callersTszProfileBrowser.do_callerscCs!tdd|j�|j�dS)Nz6Print callers statistics from the current stat object.r)r"rr�)rrrr�help_callersVszProfileBrowser.help_callerscCstdd|j�dS)Nrrr)r"r)rrMrrr�do_EOFZszProfileBrowser.do_EOFcCstdd|j�dS)NzLeave the profile brower.r)r"r)rrrr�help_EOF]szProfileBrowser.help_EOFcCsdS)Nrr)rrMrrr�do_quit`szProfileBrowser.do_quitcCstdd|j�dS)NzLeave the profile brower.r)r"r)rrrr�	help_quitbszProfileBrowser.help_quitcCs|r�yt|�|_Wn�tk
r^}z#t|jdd|j�dSWYdd}~XnItk
r�}z)t|jjd|d|j�dSWYdd}~XnX|d|_	nKt
|j	�dkr�|j	dd�}|j|�ntdd|j�dS)	Nrr�:z% rYz1No statistics object is current -- cannot reload.r���)rr�OSErrorr"rrr!r1r�r�rr�)rrM�errrrrr�es zProfileBrowser.do_readcCs*tdd|j�tdd|j�dS)Nz+Read in profile data from a specified file.rz*Without argument, reload the current file.)r"r)rrrr�	help_readvszProfileBrowser.help_readcCs0|jr|jj�ntdd|j�dS)NzNo statistics object is loaded.rr)rrjr"r)rrMrrr�
do_reversezs	zProfileBrowser.do_reversecCstdd|j�dS)Nz/Reverse the sort order of the profiling report.r)r"r)rrrr�help_reverse�szProfileBrowser.help_reversecs�|js tdd|j�dS|jj��|rst�fdd�|j�D��rs|jj|j��nTtdd|j�x>tjj	�D]-\}}td||dfd|j�q�WdS)	NzNo statistics object is loaded.rc3s|]}|�kVqdS)Nr)r�r�)�abbrevsrr�	<genexpr>�sz)ProfileBrowser.do_sort.<locals>.<genexpr>z/Valid sort keys (unique prefixes are accepted):z%s -- %srr)
rr"rr_�allr�rhrr[r5)rrMr`r�r)r�r�do_sort�s	+%zProfileBrowser.do_sortcCs*tdd|j�tdd|j�dS)Nz.Sort profile data according to specified keys.rz3(Typing `sort' without arguments lists valid keys.))r"r)rrrr�	help_sort�szProfileBrowser.help_sortcs�fdd�tjD�S)Ncs%g|]}|j��r|�qSr)r�)r��a)�textrrr��s	z0ProfileBrowser.complete_sort.<locals>.<listcomp>)rr[)rr�rr)r�r�
complete_sort�szProfileBrowser.complete_sortcCs|jd|�S)Nr�)r�)rrMrrr�do_stats�szProfileBrowser.do_statscCs!tdd|j�|j�dS)Nz.Print statistics from the current stat object.r)r"rr�)rrrr�
help_stats�szProfileBrowser.help_statscCs0|jr|jj�ntdd|j�dS)NzNo statistics object is loaded.r)rrnr"r)rrMrrr�do_strip�s	zProfileBrowser.do_stripcCstdd|j�dS)Nz<Strip leading path information from filenames in the report.r)r"r)rrrr�
help_strip�szProfileBrowser.help_stripcCstdd|j�dS)NzShow help for a given command.r)r"r)rrrr�	help_help�szProfileBrowser.help_helpcCs|r
|SdS)Nr)r�stoprMrrr�postcmd�szProfileBrowser.postcmd)r�r�r�rr�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�s4	r�rrYz*Welcome to the profile statistics browser.rzGoodbye.)!rr*r,r(rp�	functoolsr�__all__rrerkr�r6r?r�r�r�r�r��readline�ImportErrorr�r�r�argvZinitprofileZbrowserr�r�r"rZcmdloop�KeyboardInterruptrrrr�<module>sF	��
�



Hacked By AnonymousFox1.0, Coded By AnonymousFox