HEX
Server: LiteSpeed
System: Linux us-phx-web1284.main-hosting.eu 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: u300739242 (300739242)
PHP: 8.2.30
Disabled: system, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
Upload Files
File: //opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/testing/profiling.pyc
�
���ec@s
dZddlZddlZddlZddlZddlZddlZddlZddlm	Z	ddl
mZddl
mZyddl
Z
Wnek
r�dZ
nXdZdad�Zd	efd
��YZdddd
�Zejdd��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(thas_compiled_extcCs |atjrtj�ndS(N(t
_current_testt_profile_statstforce_writetreset_count(tid_((sM/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/testing/profiling.pyt_start_current_test2s	tProfileStatsFilecBskeZdZddd�Zed��Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
RS(s�Store per-platform/fn profiling results in a file.

    There was no json module available when this was written, but now
    the file format which is very deterministically line oriented is kind of
    handy in any case for diffs and merges.

    t
cumulativecCs�tjdk	otjj|_|jp?tjdk	o?tjj|_tjj	|�|_
tjj|j
�d|_t
jd��|_||_||_|j�|jr�|j�ndS(Ni����cSs
tjt�S(N(tcollectionstdefaultdicttdict(((sM/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/testing/profiling.pyt<lambda>Mt(RtoptionstNonetforce_write_profilesRtwrite_profilestwritetostpathtabspathtfnametsplittshort_fnameRRtdatatdumptsortt_readt_write(tselftfilenameRR((sM/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/testing/profiling.pyt__init__Cs			
	cCs
tjjdtjj}tjjdkrTtjjjtjj�rT|d7}ndjgtj	dd!D]}t
|�^qk�}tj�tj
�j�tj�j�||g}|jtjjjr�dnd�t�}|j|r�d	p�d
�dj|�S(Nt_tsqlitet_filet.iit
nativeunicodetdbapiunicodetcextensionst
nocextensions(Rtdbtnametdrivertdialectt_is_url_file_dbturltjointsystversion_infotstrtplatformtmachinetsystemtlowertpython_implementationtappendtconvert_unicodeR(R t	dbapi_keytvt
py_versiontplatform_tokenst	_has_cext((sM/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/testing/profiling.pytplatform_keyWs 
2			cCs)t}||jko(|j|j|kS(N(RRRA(R ttest_key((sM/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/testing/profiling.pyt	has_statsusc	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(RRRAtlenR:RRR(	R t	callcountRBtper_fntper_platformRDREt	has_counttresult((sM/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/testing/profiling.pyRL{s$




	
	cCsdt}||jkrdS|j|}|j|kr9dS||j}d|kr`g|d(ndS(NRD(RRRA(R RBRIRJ((sM/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/testing/profiling.pyR�s

cCs{t}|j|}||j}|d}|d}|t|�krW|||d<n
||d<|jrw|j�ndS(NRDREii����(RRRARGRR(R RHRBRIRJRDRE((sM/opt/alt/python27/lib/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 ((sM/opt/alt/python27/lib/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,RDiRFiRE(
topenRtIOErrort	enumeratetstript
startswithRRtinttclose(R t	profile_fRFtlineRBRARDRIRJtcounttc((sM/opt/alt/python27/lib/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

RPcss|]}t|�VqdS(N(R4(t.0RZ((sM/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/testing/profiling.pys	<genexpr>�sRDs	%s %s %s
(RRQRRNtsortedRR1RW(R RXRBRIRARJR[((sM/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/testing/profiling.pyR�s

"N(t__name__t
__module__t__doc__RR"tpropertyRARCRLRRMRNRR(((sM/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/testing/profiling.pyR	:s			
	
		g�������?icshddlm}ddlm�ddlm�ddlm�|������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.

    i����(t	decorator(tdeprecations(trow(tmockcs��jj�dt����jj�dt����jj�jd�j��ox!t��D]}|||�q^Wt��}td���)x|D]}|||�}q�W|SWdQXWdQXWdQXWdQXdS(NtSQLALCHEMY_WARN_20tSILENCE_UBER_WARNINGt_default_key_styletvariance(tpatchtobjecttFalsetTruet	LegacyRowtKEY_OBJECTS_NO_WARNtrangetcount_functions(tfntargstkwtwarmt	timerangettimetrv(RdRfRettimesRjtwarmup(sM/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/testing/profiling.pytwrap�s			
(tsqlalchemy.utilRcRdtsqlalchemy.engineRetsqlalchemy.testingRf(RjRzR{RcR|((RdRfReRzRjR{sM/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/testing/profiling.pytfunction_call_count�s$c
cs�tdkrtjd��ntj�rLtjrLtjdtj�nt	�tj
�}|j�dV|j�t
j|dtj�}|j}tj|�}|dkr�d}n|\}}d||fGH|jtjdtj��|j�tjrgtjjtj�\}}tjd�d}	d||	|pGd	f}
|j|
�d
|
GHntjr�tj|�nt|r�t ||�}t!||�|k}|r�tjr�tj|�q�t"d||d|tj#f��q�ndS(
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 %ss[, ]R&i����s%s_%s%ss.profilesDumped stats to file %ss�Adjusted function call count %s not within %s%% of expected %s, platform %s. Rerun with --write-profiles to regenerate this callcount.id($tcProfileRRt_skip_test_exceptionRRCRt	skip_testRRtProfiletenabletdisabletpstatstStatsR2tstdoutttotal_callsRLt
sort_statstreRRtprint_statsRRRtsplitextRt
dump_statsRRMRVtabstAssertionErrorRA(
RjtprtstatsRHtexpectedtexpected_counttline_notbasetextt	test_nametdumpfiletdeviancetfailed((sM/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/testing/profiling.pyRrsP

		
	
		(RaRt
contextlibRR5R�R�R2RRtutilRRR�tImportErrorRRRRRlR	R�tcontextmanagerRr(((sM/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/testing/profiling.pyt<module>
s*

		�*