%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/alt/python27/lib/python2.7/site-packages/libfuturize/fixes/
Upload File :
Create Path :
Current File : //opt/alt/python27/lib/python2.7/site-packages/libfuturize/fixes/fix_division_safe.pyo

�
�A�[c@s�dZddlZddljZddlmZmZmZddlm	Z	ddlm
Z
mZddlm
Z
mZmZmZd�Zejd�Zd	�Zd
�Zd�Zd�Zd
e	jfd��YZdS(sL
For the ``future`` package.

Adds this import line:

    from __future__ import division

at the top and changes any old-style divisions to be calls to
past.utils.old_div so the code runs as before on Py2.6/2.7 and has the same
behaviour on Py3.

If "from __future__ import division" is already in effect, this fixer does
nothing.
i����N(tLeaftNodetComma(t
fixer_base(tsymstdoes_tree_import(ttokent
future_importttouch_import_toptwrap_in_fn_callcCs<tj}|j|ko;|jj|ko;|jj|kS(uw
    __future__.division redefines the meaning of a single slash for division,
    so we match that and only that.
    (RtSLASHttypetnext_siblingtprev_sibling(tnodetslash((sT/opt/alt/python27/lib/python2.7/site-packages/libfuturize/fixes/fix_division_safe.pytmatch_divisions	"s^[0-9]*[.][0-9]*$cCs+t|jd|!�p*t|j|d�S(Nii(t
_is_floatytchildren(Rtdiv_idx((sT/opt/alt/python27/lib/python2.7/site-packages/libfuturize/fixes/fix_division_safe.pyt	is_floaty$scCs{t|t�r|d}nt|t�r;tj|j�St|t�rwt|jdt�rw|jdjdkSntS(Niufloat(	t
isinstancetlistRtconst_retmatchtvalueRRtFalse(texpr((sT/opt/alt/python27/lib/python2.7/site-packages/libfuturize/fixes/fix_division_safe.pyR(s
cCs4x-t|j�D]\}}t|�r|SqWtS(N(t	enumerateRRR(Rtitchild((sT/opt/alt/python27/lib/python2.7/site-packages/libfuturize/fixes/fix_division_safe.pyt
find_division5scCsig}xOt|j�D]>\}}||krA|jt��q|j|j��qWd|d_|S(Nui(RRtappendRtclonetprefix(RRRRR((sT/opt/alt/python27/lib/python2.7/site-packages/libfuturize/fixes/fix_division_safe.pytclone_div_operands;s
tFixDivisionSafecBs8eZdZejZdZd�Zd�Zd�Z	RS(is4
    term<(not('/') any)+ '/' ((not('/') any))>
    cCs/tt|�j||�d|jk|_dS(sO
        Skip this fixer if "__future__.division" is already imported.
        tdivisionN(tsuperR$t
start_treetfuture_featurestskip(tselfttreetname((sT/opt/alt/python27/lib/python2.7/site-packages/libfuturize/fixes/fix_division_safe.pyR'RscCsS|j|jjkrOt|�}|tk	rOt||�sLt||�SqOntS(u�
        Since the tree needs to be fixed once and only once if and only if it
        matches, we can start discarding matches after the first.
        (RRttermRRRR#(R*RR((sT/opt/alt/python27/lib/python2.7/site-packages/libfuturize/fixes/fix_division_safe.pyRYscCs@|jr
dStd|�tdd|�td|d|j�S(Nudivisionu
past.utilsuold_divtold_divR"(R)RRR	R"(R*Rtresults((sT/opt/alt/python27/lib/python2.7/site-packages/libfuturize/fixes/fix_division_safe.pyt	transformhs
	
(
t__name__t
__module__t	run_orderRR
t_accept_typetPATTERNR'RR0(((sT/opt/alt/python27/lib/python2.7/site-packages/libfuturize/fixes/fix_division_safe.pyR$Hs			(t__doc__tretlib2to3.pytreetpytreetlib2to3.fixer_utilRRRtlib2to3RRRtlibfuturize.fixer_utilRRRR	RtcompileRRRRR#tBaseFixR$(((sT/opt/alt/python27/lib/python2.7/site-packages/libfuturize/fixes/fix_division_safe.pyt<module>s"				
		

Zerion Mini Shell 1.0