https://t.me/AnonymousX5
Server : Apache
System : Linux cvar2.toservers.com 3.10.0-962.3.2.lve1.5.73.el7.x86_64 #1 SMP Wed Aug 24 21:31:23 UTC 2022 x86_64
User : njnconst ( 1116)
PHP Version : 8.4.18
Disable Function : NONE
Directory :  /usr/lib64/python2.7/site-packages/sqlalchemy/testing/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/lib64/python2.7/site-packages/sqlalchemy/testing/profiling.pyc
�
���\c@sdZddlZddlZddlZddlZddlZddlmZddlm	Z	ddlm
Z
ddlmZdd	lmZdd
lm
Z
yddlZWnek
r�dZnXdZdZdefd��YZd
d�Zejd
d��ZdS(s�Profiling support for unit and performance tests.

These are special purpose profiling methods which operate
in a more fine-grained way than nose's profiling plugin.

i����Ni(tconfig(t
gc_collecti(tjython(tpypy(tupdate_wrapper(twin32tProfileStatsFilecBs\eZdZd�Zed��Zd�Zd�Zd�Zd�Z	d�Z
d�ZRS(	s�"Store per-platform/fn profiling results in a file.

    We're still targeting Py2.5, 2.4 on 0.7 with no dependencies,
    so no json lib :(  need to roll something silly

    cCs�tjdk	otjj|_|jp?tjdk	o?tjj|_tjj	|�|_
tjj|j
�d|_t
jd��|_|j�|jr�|j�ndS(Ni����cSs
tjt�S(N(tcollectionstdefaultdicttdict(((sB/usr/lib64/python2.7/site-packages/sqlalchemy/testing/profiling.pyt<lambda>:s(RtoptionstNonetforce_write_profilestforce_writetwrite_profilestwritetostpathtabspathtfnametsplittshort_fnameRRtdatat_readt_write(tselftfilename((sB/usr/lib64/python2.7/site-packages/sqlalchemy/testing/profiling.pyt__init__0s	
	cCs�tjjdtjj}djgtjdd!D]}t|�^q1�}|g}|j|�t	rx|jd�nt
r�|jd�ntr�|jd�n|jtjjj
r�dnd	�tjj�}|j|r�d
p�d�dj|�S(Nt_t.iiRRtwint
nativeunicodetdbapiunicodetcextensionst
nocextensions(Rtdbtnametdrivertjointsystversion_infotstrtappendRRRtdialecttconvert_unicodetrequirementst_has_cextensions(Rt	dbapi_keytvt
py_versiontplatform_tokenst	_has_cext((sB/usr/lib64/python2.7/site-packages/sqlalchemy/testing/profiling.pytplatform_keyBs 2	
cCs)t}||jko(|j|j|kS(N(t
_current_testRR5(Rttest_key((sB/usr/lib64/python2.7/site-packages/sqlalchemy/testing/profiling.pyt	has_stats[sc	Cs�t}|j|}||j}d|kr=g|d<}n
|d}d|krdd|d<}n
|d}t|�|k}|s�|j|�|jr�|j�nd}n|d||f}|dcd7<|S(Ntcountst
current_countitlinenoi(R6RR5tlenR+RRR(	Rt	callcountR7tper_fntper_platformR9R:t	has_counttresult((sB/usr/lib64/python2.7/site-packages/sqlalchemy/testing/profiling.pyRAas$




	
	cCs{t}|j|}||j}|d}|d}|t|�krW|||d<n
||d<|jrw|j�ndS(NR9R:ii����(R6RR5R<RR(RR=R7R>R?R9R:((sB/usr/lib64/python2.7/site-packages/sqlalchemy/testing/profiling.pytreplace|s




	cCsd|jS(Ns
# %s
# This file is written out on a per-environment basis.
# For each test in aaa_profiling, the corresponding function and 
# environment is located within this file.  If it doesn't exist,
# the test is skipped.
# If a callcount does exist, it is compared to what we received. 
# assertions are raised if the counts do not match.
# 
# To add a new callcount test, apply the function_call_count 
# decorator and re-run the tests using the --write-profiles 
# option - this file will be rewritten including the new count.
# 
(R(R((sB/usr/lib64/python2.7/site-packages/sqlalchemy/testing/profiling.pyt_header�scCs�yt|j�}Wntk
r'dSXx�t|�D]�\}}|j�}|s5|jd�riq5n|j�\}}}|j|}||}g|jd�D]}	t|	�^q�}
|
|d<|d|d<d|d<q5W|j	�dS(Nt#t,R9iR;iR:(
topenRtIOErrort	enumeratetstript
startswithRRtinttclose(Rt	profile_fR;tlineR7R5R9R>R?tcounttc((sB/usr/lib64/python2.7/site-packages/sqlalchemy/testing/profiling.pyR�s 


(
cCs�d|jGHt|jd�}|j|j��x�t|j�D]|}|j|}|jd|�xUt|�D]G}||}djd�|dD��}|jd|||f�qrWqAW|j�dS(NsWriting profile file %stws

# TEST: %s

REcss|]}t|�VqdS(N(R*(t.0RO((sB/usr/lib64/python2.7/site-packages/sqlalchemy/testing/profiling.pys	<genexpr>�sR9s	%s %s %s
(RRFRRCtsortedRR'RL(RRMR7R>R5R?RP((sB/usr/lib64/python2.7/site-packages/sqlalchemy/testing/profiling.pyR�s

"(t__name__t
__module__t__doc__RtpropertyR5R8RARBRCRR(((sB/usr/lib64/python2.7/site-packages/sqlalchemy/testing/profiling.pyR(s				
		g�������?cs�fd�}|S(s�Assert a target for a test case's function call count.

    The main purpose of this assertion is to detect changes in
    callcounts for various functions - the actual number is not as important.
    Callcounts are stored in a file keyed to Python version and OS platform
    information.  This file is generated automatically for new tests,
    and versioned so that unexpected changes in callcounts will be detected.

    cs��fd�}t|��S(Ncs'td����||�SWdQXdS(Ntvariance(tcount_functions(targstkw(tfnRX(sB/usr/lib64/python2.7/site-packages/sqlalchemy/testing/profiling.pytwrap�s(R(R\R](RX(R\sB/usr/lib64/python2.7/site-packages/sqlalchemy/testing/profiling.pytdecorate�s((RXR^((RXsB/usr/lib64/python2.7/site-packages/sqlalchemy/testing/profiling.pytfunction_call_count�sc	csptdkrtjd��ntj�rLtjrLtjdtj�nt	�tj
�}|j�dV|j�t
j|dtj�}|j}tj|�}|dkr�d}n|\}}d||fGH|jd�|j�|rlt||�}t||�|k}|s*tjrltjrCtj|�qitd||d|tjf��qlndS(NscProfile is not installeds�No profiling stats available on this platform for this function.  Run tests with --write-profiles to add statistics to %s for this platform.tstreamsPstats calls: %d Expected %st
cumulatives�Adjusted function call count %s not within %s%% of expected %s, platform %s. Rerun with --write-profiles to regenerate this callcount.id(tcProfileRRt_skip_test_exceptiont_profile_statsR8Rt	skip_testRRtProfiletenabletdisabletpstatstStatsR(tstdoutttotal_callsRAt
sort_statstprint_statsRKtabsRRBtAssertionErrorR5(	RXtprtstatsR=texpectedtexpected_counttline_notdeviancetfailed((sB/usr/lib64/python2.7/site-packages/sqlalchemy/testing/profiling.pyRY�s@

		

	(RVRt
contextlibRRiR(tRtutilRRRRRRbtImportErrorRR6RdtobjectRR_tcontextmanagerRY(((sB/usr/lib64/python2.7/site-packages/sqlalchemy/testing/profiling.pyt<module>
s*

�

https://t.me/AnonymousX5 - 2025