Your IP : 216.73.216.213


Current Path : /proc/242857/root/opt/alt/python27/lib/python2.7/site-packages/py/_code/
Upload File :
Current File : //proc/242857/root/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pyo

�
%q�]c@seddlZddlZddlZddlmZmZmZddlmZm	Z	ej
jZddEd��YZ
defd��YZd�Zd	efd
��YZdefd��YZd
efd��YZdefd��YZdefd��YZgZxQidej6dej6j�D]/\ZZdefd��YZeje�q)Wxyidej6dej6dej 6dej!6dej"6dej#6j�D]/\ZZdefd��YZ$eje$�q�Wdefd ��YZ%d!efd"��YZ&d#efd$��YZ'd%efd&��YZ(d'efd(��YZ)d)efd*��YZ*d+�Z+dd,�Z-e.d-�Z/d.�Z0d/�Z1dd0�Z2e3d1krad2�Z4d3�Z5d4�Z6e-d5�e-d6�e-d7�e-d8�d9Z7e-d:�e-d;�e-d<�e2d=�e-d>�e2d?�e2d@�e2dA�e-dB�e-dC�e2dD�ndS(Fi����N(tparsetastt	pycodegen(tBuiltinAssertionErrort_format_explanationtFailurecBseZd�ZRS(cCs+tj�\|_|_|_||_dS(N(tsystexc_infotexctvaluettbtnode(tselfR((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pyt__init__	s(t__name__t
__module__R
(((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pyRstViewcBsPeZdZiZdZd�Zd�Zd�Zd�Zd�Z	d�Z
RS(s�View base class.

    If C is a subclass of View, then C(x) creates a proxy object around
    the object x.  The actual class of the proxy is not C in general,
    but a *subclass* of C determined by the rules below.  To avoid confusion
    we call view class the class of the proxy (a subclass of C, so of View)
    and object class the class of x.

    Attributes and methods not found in the proxy are automatically read on x.
    Other operations like setting attributes are performed on the proxy, as
    determined by its view class.  The object x is available from the proxy
    as its __obj__ attribute.

    The view class selection is determined by the __view__ tuples and the
    optional __viewkey__ method.  By default, the selected view class is the
    most specific subclass of C whose __view__ mentions the class of x.
    If no such subclass is found, the search proceeds with the parent
    object classes.  For example, C(True) will first look for a subclass
    of C with __view__ = (..., bool, ...) and only if it doesn't find any
    look for one with __view__ = (..., int, ...), and then ..., object,...
    If everything fails the class C itself is considered to be the default.

    Alternatively, the view class selection can be driven by another aspect
    of the object x, instead of the class of x, by overriding __viewkey__.
    See last example at the end of this module.
    cOsktj|�}||_||_|j�}y|j||_Wn#tk
rf|j|�|_nX|S(N(	tobjectt__new__t__obj__t
__rootclass__t__viewkey__t
_viewcachet	__class__tKeyErrort_selectsubclass(t	rootclasstobjtargstkwdsRtkey((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pyR,s		
cCst|j|�S(N(tgetattrR(Rtattr((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pyt__getattr__7scCs
|jjS(N(RR(R((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pyR<scCsqtj|�r!tj|�}n	|g}x@|D]8}g|D]}||jkr>|^q>}|r1|Sq1WgS(N(tinspecttisclasstgetmrot__view__(RRt
subclassestkeystCtresult((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pyt__matchkey__?s	
(cCs�tt|j��}x2|D]*}t|jt�s|jf|_qqW|j||�}|si|jSt|�dkr�|dStdt|�i�SdS(Niit?(	tlisttenumsubclassesRt
isinstanceR%ttupleR*tlenttype(RRR&R(tchoices((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pyRJs
cCsd|jj|jfS(Ns%s(%r)(RRR(R((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pyt__repr__Xs((RRt__doc__RR%RR!RR*RR3(((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pyR
s					ccs<x0|j�D]"}xt|�D]}|Vq Wq
W|VdS(N(t__subclasses__R-(tclstsubclstsubsubclass((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pyR-\s
t
InterpretablecBs8eZdZdZd�Zd�Zd�Zd�ZRS(s+A parse tree node with a few extra methods.cCstS(N(tFalse(Rtframe((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pyt
is_builtingscCs�yOtj|j�}d|_d|j_tj|�j�}|j|�}Wn&tk
re�nt	|��nX||_
|jp�|j|j
�|_dS(Ns<eval>(
Rt
ExpressionRtfilenameRtExpressionCodeGeneratortgetCodetevalt
passthroughexRR)texplanationtrepr(RR;texprtcoR)((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pyRAjs	
	cCs}yPtjdtj|jg��}d|_tj|�j�}|j	|�Wn&t
k
rf�nt|��nXdS(Ns<run>(RtModuletNonetStmtRR>RtModuleCodeGeneratorR@texec_RBR(RR;RERF((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pytrunys!	
cCs
t|j�S(N(RRC(R((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pytnice_explanation�sN(	RRR4RHRCR<RARLRM(((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pyR9cs			tNamecBs5eZejZd�Zd�Zd�Zd�ZRS(cCsId|j}y|j|j|��SWntk
r=�ntSXdS(Ns%r in locals() is not globals()(tnametis_trueRARBR:(RR;tsource((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pytis_local�s

cCsId|j}y|j|j|��SWntk
r=�ntSXdS(Ns%r in globals()(RORPRARBR:(RR;RQ((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pyt	is_global�s

cCsRd|j|jf}y|j|j|��SWntk
rF�ntSXdS(Ns*%r not in locals() and %r not in globals()(RORPRARBR:(RR;RQ((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pyR<�s
cCs8tt|�j|�|j|�s4|j|_ndS(N(tsuperRNRARRRORC(RR;((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pyRA�s(	RRRRNR%RRRSR<RA(((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pyRN�s
						
tComparecBseZejZd�ZRS(cCs�t|j�}|j|�x�|jD]�\}}t|d�rZ|j|j�sZPqZnt|�}|j|�d|j||jf|_d|}y(|j|d|jd|j�|_Wn&tk
r��nt	|��nX|}q&WdS(NR)s%s %s %ss#__exprinfo_left %s __exprinfo_rightt__exprinfo_leftt__exprinfo_right(
R9RERAtopsthasattrRPR)RCRBR(RR;REt	operationtexpr2RQ((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pyRA�s(


	
(RRRRUR%RA(((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pyRU�s	tAndcBseZejZd�ZRS(cCs�g}x\|jD]Q}t|�}|j|�|j|j�|j|_|j|j�sPqqWddj|�d|_dS(Nt(s and t)(tnodesR9RAtappendRCR)RPtjoin(RR;texplanationsRE((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pyRA�s
(RRRR\R%RA(((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pyR\�s	tOrcBseZejZd�ZRS(cCs�g}x\|jD]Q}t|�}|j|�|j|j�|j|_|j|j�rPqqWddj|�d|_dS(NR]s or R^(R_R9RAR`RCR)RPRa(RR;RbRE((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pyRA�s
(RRRRcR%RA(((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pyRc�s	snot __exprinfo_exprs(~__exprinfo_expr)t
UnaryArithcBseZeZed�ZRS(cCs�t|j�}|j|�|jd|j�|_y|j|d|j�|_Wn&tk
ri�nt|��nXdS(Nt__exprinfo_expr(R9RERAtreplaceRCR)RBR(RR;t
astpatternRE((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pyRA�s
	
(RRtastclassR%RgRA(((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pyRd�ss$(__exprinfo_left + __exprinfo_right)s$(__exprinfo_left - __exprinfo_right)s$(__exprinfo_left * __exprinfo_right)s$(__exprinfo_left / __exprinfo_right)s$(__exprinfo_left % __exprinfo_right)s%(__exprinfo_left ** __exprinfo_right)tBinaryArithcBseZeZed�ZRS(cCs�t|j�}|j|�t|j�}|j|�|jd|j�jd|j�|_y(|j|d|jd|j�|_Wn&tk
r��nt|��nXdS(NRVRW(	R9tleftRAtrightRfRCR)RBR(RR;RgRjRk((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pyRA
s

	
(RRRhR%RgRA(((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pyRistCallFunccBs#eZejZd�Zd�ZRS(cCsKd}y#|j|j|d|j��SWntk
r?�ntSXdS(Ns"isinstance(__exprinfo_value, bool)t__exprinfo_value(RPRAR)RBR:(RR;RQ((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pytis_bool!s
cCs�t|j�}|j|�g}i|jd6}d}x�|jD]�}t|tj�ro|j}|j	}nd}t|�}|j|�dt|�}|j||<|dkr�||d7}|j|j
�qB|d||f7}|jd||j
f�qBW|jrkt|j�}	|	j|�d}|	j||<|d|d7}|jd|	j
�n|jr�t|j�}
|
j|�d	}|
j||<|d
|d7}|jd
|
j
�nd|j
dj|�f|_
|jd�r|d
 }n|d7}y|j||�|_Wn&tk
r@�nt|��nX|j|�ss|j|�r�|j|j�}d|||j
f|_
ndS(Nt
__exprinfo_fns__exprinfo_fn(s
__exprinfo_%dt,s%s=%s,s%s=%st__exprinfo_start*t__exprinfo_kwdss**s%s(%s)s, i����R^s
%s
{%s = %s
}(R9RRAR)RR.RtKeywordRORERHR0R`RCt	star_argst
dstar_argsRatendswithRBRR<RnRD(RR;RRbtvarsRQtatkeywordtargnameRuRvtr((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pyRA+s^
	

	

	




 (RRRRlR%RnRA(((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pyRls		
tGetattrcBseZejZd�ZRS(cCst|j�}|j|�d|j}y|j|d|j�|_Wn&tk
r^�nt|��nXd|j|jf|_d|j}y%|j|j|d|j��}Wn tk
r��n
t	}nX|r|j
|j�}d|||jf|_ndS(Ns__exprinfo_expr.%sRes%s.%ssGhasattr(__exprinfo_expr, "__dict__") and %r in __exprinfo_expr.__dict__s
%s
{%s = %s
}(R9RERAtattrnameR)RBRRCRPtTrueRD(RR;RERQt
from_instanceR|((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pyRAas,





(RRRR}R%RA(((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pyR}^s	tAssertcBseZejZd�ZRS(cCs�t|j�}|j|�|jjd�rV|jjd�rV|jdd!|_n|j|_d|j|_|j|j�s�y
t�Wq�t	k
r��q�t
|��q�XndS(NsFalse
{False = s
}ii����sassert (R9ttestRARCt
startswithRwR)RPRRBR(RR;R�((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pyRLs


(RRRR�R%RL(((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pyR�|s	tAssigncBseZejZd�ZRS(cCs�t|j�}|j|�|j|_d|j|_tj|jtjd��}tj	dtj|g��}d|_t
j|�j�}y|j|d|j�Wn&tk
r��nt|��nXdS(Ns... = Res<run>(R9RERAR)RCRR�R_RNRGRHRIR>RRJR@RKRBR(RR;REtasstmodRF((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pyRL�s
	
(RRRR�R%RL(((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pyR��s	tDiscardcBseZejZd�ZRS(cCs8t|j�}|j|�|j|_|j|_dS(N(R9RERAR)RC(RR;RE((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pyRL�s
(RRRR�R%RL(((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pyR��s	RIcBseZejZd�ZRS(cCs1x*|jD]}t|�}|j|�q
WdS(N(R_R9RL(RR;tstmt((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pyRL�s(RRRRIR%RL(((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pyRI�s	cCsR|jj�}|r"d|}nd}tjjd|jj|j|f�dS(Ns, in: ts	%s: %s%s
(RRMRtstdouttwriteRRR	(teRC((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pytreport_failure�s

cCs�|dkr0tjd�}tjj|�}nt|d�}t|j�}y|j	|�Wn>t
k
ru�nZtk
r�tj�d}t
|�n0X|j|j�s�tjjd|j��ndS(NiRAsassertion failed: %s
(RHRt	_getframetpytcodetFrameRR9RRARBRRR�RPR)tstderrR�RM(tsR;RERR�((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pytcheck�s

cCs�tt|d�j�}t|tjjj�rEtjj	|�}ny|j
|�WnWtk
r�tj
�d}t|�Stk
r��nddl}|j�nX|r�dSdSdS(Ntexecii����s�(assertion failed, but when it was re-run for printing intermediate values, it did not fail.  Suggestions: compute assert expression before the assert or use --nomagic)(R9RRR.R�tstdttypest	FrameTypeR�R�RLRRRt
getfailureRBt	tracebackt	print_excRH(RQR;tshould_failtmoduleR�R�((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pyt	interpret�s 


cCs�t|t�r$tjj|�}n|jd}t|j�j�}t	||j
dt�}t|t�s�td|f��n|S(Ni����R�s interpret returned non-string %r(
R.R/R�R�t
ExceptionInfoR�tstrt	statementtstripR�R;Rt	TypeError(texcinfoR
RQtx((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pytgetmsg�s
cCs�|jj�}t|j�rY|jd�}|dcd|jf7<dj|�}nd|jj|f}|jd�r�|d}n|S(Ns
is  << %ss%s: %ssAssertionError: assert i(	RRMR�R	tsplitRaRRR�(R�RCtlinesttext((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pyR��s
cCs�|dkr0tjd�}tjj|�}ntt|d�j�}y|j	|�Wn+t
k
r�tj�d}t|�nXdS(NiR�(
RHRR�R�R�R�R9RRRLRRR�(R�R;R�R�((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pyRLs
t__main__cCsdS(Ni((((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pytfscCsdS(Ni((((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pytgscCsdS(Ntnever((R�((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pythssf() * g() == 5snot f()snot (f() and g() or 0)s
f() == g()isi == f()s
len(f()) == 0sisinstance(2+3+4, float)sx = isx == 5sassert not f(), 'oops'sa, b, c = 1, 2s
a, b, c = f()smax([f(),g()]) == 4s'hello'[g()] == 'h's'guk%d' % h(f())((8R�RR"tcompilerRRRtpy._code.assertionRRtbuiltint_sysexRBRRRR-R9RNRUR\Rct	keepalivetNottInverttitemsRhRgRdR`tAddtSubtMultDivtModtPowerRiRlR}R�R�R�RIR�RHR�R:R�R�R�RLRR�R�R�ti(((sG/opt/alt/python27/lib/python2.7/site-packages/py/_code/_assertionold.pyt<module>svO	&$





@