%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/
Upload File :
Create Path :
Current File : //opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/util.pyo

�
��4]c@s�ddlZddlZddlZddlZddlZddlZddlmZddlmZddlm	Z	ddlm
Z
ddlmZe	r�d�ZeZ
Zn.er�d	�ZeZ
ZnejZ
d
�Zd�Zd�Zd
efd��YZd�Zd�Zd�Zd�Zd�Zd�Zed��Zd�Zdefd��YZddd�Z d�Z!dS(i����Ni(t	decorator(tdefaultdict(tjython(tpy2k(tpypycGs/tj�tjd�tj�tj�dS(s aggressive gc.collect for tests.g�������?i(tgctcollectttimetsleep(targs((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/util.pytjython_gc_collects




cGstj�tj�dS(N(RR(R	((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/util.pytpypy_gc_collect$s
cCsdS(N((((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/util.pytlazy_gc-sc#s�t�}trCyddl}|j|�WqCtk
r?qCXnddl}|j|�xE|D]=�x4td|j�D] ��j��fd�fVq|WqcWdS(Ni����i����cs�j|��S(N(tdumps(td(tpickle_tprotocol(sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/util.pyt<lambda>Bt(	tsetRtcPickletaddtImportErrortpickletrangetHIGHEST_PROTOCOLtloads(tpicklersRR((RRsJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/util.pyR1s	


cCsNt|t�rt||�S|tjdd|�jtj�td|�S(Nt1t0i
(t
isinstancetfloattroundtdecimaltDecimaltto_integraltROUND_FLOORtpow(tvaluetprec((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/util.pyt
round_decimalEs

	t	RandomSetcBs>eZd�Zd�Zd�Zd�Zd�Zd�ZRS(cCs,ttj|��}tj|�t|�S(N(tlistRt__iter__trandomtshuffletiter(tselftl((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/util.pyR+Ps
cCsFtjdt|�d�}ttj|��|}|j|�|S(Nii(R,trandinttlenR*RR+tremove(R/tindextitem((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/util.pytpopUs
cCsttj||��S(N(R)Rtunion(R/tother((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/util.pyR7[scCsttj||��S(N(R)Rt
difference(R/R8((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/util.pyR9^scCsttj||��S(N(R)Rtintersection(R/R8((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/util.pyR:ascCs
t|�S(N(R)(R/((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/util.pytcopyds(t__name__t
__module__R+R6R7R9R:R;(((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/util.pyR)Os					cCs�tt�}x%|D]\}}||j|�qWxGt|�D]5\}}x&||D]}|||krXtSqXWqAWtSdS(sATrue if the given sorting conforms to the given partial ordering.N(RRRt	enumeratetFalsetTrue(ttuplestsorted_elementstdepstparenttchildtitnodetn((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/util.pytconforms_partial_orderinghscsVtt��x%|D]\}}�|j|�qW��fd��t�|��S(Nc3s�t|�dkr t|�Vnbx_|D]W}t|�j|g�}|j�|�s'x#�|�D]}|g|VqeWq'q'WdS(Ni(R2R*RR9R:(telementstelemtsubsettsub_ordering(t_all_orderingstedges(sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/util.pyRN{s
(RRRR.(RARJRDRE((RNROsJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/util.pytall_partial_orderingsvs
cCsLy
||_Wn8tk
rGtj|j|j||j|j�}nX|S(scReturn a function with a given __name__.

    Will assign to __name__ and return the original function if possible on
    the Python implementation, otherwise a new function will be constructed.

    This function should be phased out as much as possible
    in favor of @decorator.   Tests that "generate" many named tests
    should be modernized.

    (R<t	TypeErrorttypestFunctionTypet__code__t__globals__t__defaults__t__closure__(tfntname((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/util.pytfunction_named�s

%cOsr|j�}y-||||�}|jddd�|SWn2tj�}|j|�}|sf�qn|SnXdS(sRun the given function under the given contextmanager,
    simulating the behavior of 'with' to support older
    Python versions.

    This is not necessary anymore as we have placed 2.6
    as minimum Python version, however some tests are still using
    this structure.

    N(t	__enter__t__exit__tNonetsystexc_info(tctxRXtargtkwtobjtresultR_traise_((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/util.pytrun_as_contextmanager�scCsd�|D�S(s�Converts the results of sql execution into a plain set of column tuples.

    Useful for asserting the results of an unordered query.
    cSsh|]}t|��qS((ttuple(t.0trow((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/util.pys	<setcomp>�s	((tresults((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/util.pytrowset�scCsdS(N((tmsg((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/util.pytfail�sc	Os�ddlm}ddlm}ddlm}|j|j�}|d}t|dd�}||_	z|||�SWd|j
||j�||_	XdS(	s>Provide bound MetaData for a single test, dropping afterwards.i(tconfig(tenginesi����(tschemaitmetadataN(RRnRot
sqlalchemyRptMetaDatatdbtgetattrR]Rqtdrop_all_tables(	RXR	RbRnRoRpRqR/t	prev_meta((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/util.pytprovide_metadata�s
	cs?ddlm�ddlm�t���fd��}|S(siForce the given table names to be dropped after test complete,
    isolating for foreign key cycles

    i(Rni����(tinspectcs8z|||�SWdt�j��j�d��XdS(Nt
include_names(RvRt(RXR	Rb(RnRytnames(sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/util.pytgo�s(RRnRrRyR(R{R|((RnRyR{sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/util.pytforce_drop_names�stadictcBs&eZdZd�Zd�ZeZRS(s,Dict keys available as attributes.  Shadows.cCs1y||SWntk
r,tj||�SXdS(N(tKeyErrortdictt__getattribute__(R/tkey((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/util.pyR��s
cGs!tg|D]}||^q
�S(N(Rg(R/tkeysR�((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/util.pyt__call__�s(R<R=t__doc__R�R�tget_all(((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/util.pyR~�s		c
Cs�ddlm}m}m}m}m}ddlm}	m}
|dk	rYt
|�}n|j��0}x&t|j
d|��D]\}}
|r�|dk	r�||kr�q�n|j|	|||�d|���q�|
r�|jjs�q�nx�|
D]�\}}|dk	r"||kr"q�n|||�|d|�|d|�d|�}|j|
||jjg|jjgd|���q�Wq�q�WWdQXdS(Ni����(tColumntTabletIntegerRstForeignKeyConstraint(t	DropTabletDropConstraintRptxtyRY(RrR�R�R�RsR�tsqlalchemy.schemaR�R�R]Rtconnecttreversedtget_sorted_table_and_fkc_namestexecutetdialecttsupports_altertcR�R�(tenginet	inspectorRpRzR�R�R�RsR�R�R�tconnttnametfkcstfkcttb((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/util.pyRv�s8("	cst�fd��}|S(Ncs#z|||�SWd�j�XdS(N(t_clear(RXRaRb(t	event_cls(sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/util.pytdecorate's(R(R�R�((R�sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/util.pytteardown_events&s("R!RR,R^RRRtutilRRRRRR
t
gc_collectRRRRR(RR)RIRPRZRfRkRmRxR}R�R~R]RvR�(((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/util.pyt<module>s@		
	
				
								.

Zerion Mini Shell 1.0