ó p”þfc@s_dZddlmZddlmZmZmZddlmZdejfd„ƒYZ dS(s/Fixer that changes xrange(...) into range(...).i(t fixer_base(tNametCalltconsuming_calls(tpatcompt FixXrangecBsteZeZdZd„Zd„Zd„Zd„Zd„Z dZ e j e ƒZ dZe j eƒZd„ZRS( sˆ power< (name='range'|name='xrange') trailer< '(' args=any ')' > rest=any* > cCs)tt|ƒj||ƒtƒ|_dS(N(tsuperRt start_treetsetttransformed_xranges(tselfttreetfilename((s0/usr/lib64/python2.7/lib2to3/fixes/fix_xrange.pyRscCs d|_dS(N(tNoneR (R R R ((s0/usr/lib64/python2.7/lib2to3/fixes/fix_xrange.pyt finish_treescCs^|d}|jdkr)|j||ƒS|jdkrH|j||ƒStt|ƒƒ‚dS(Ntnameuxrangeurange(tvaluettransform_xrangettransform_ranget ValueErrortrepr(R tnodetresultsR((s0/usr/lib64/python2.7/lib2to3/fixes/fix_xrange.pyt transforms  cCs@|d}|jtdd|jƒƒ|jjt|ƒƒdS(NRurangetprefix(treplaceRRR taddtid(R RRR((s0/usr/lib64/python2.7/lib2to3/fixes/fix_xrange.pyR$s cCs’t|ƒ|jkrŽ|j|ƒ rŽttdƒ|djƒgƒ}ttdƒ|gd|jƒ}x|dD]}|j|ƒqsW|SdS(NurangetargsulistRtrest(RR tin_special_contextRRtcloneRt append_child(R RRt range_callt list_calltn((s0/usr/lib64/python2.7/lib2to3/fixes/fix_xrange.pyR*s" s3power< func=NAME trailer< '(' node=any ')' > any* >sŸfor_stmt< 'for' any 'in' node=any ':' any* > | comp_for< 'for' any 'in' node=any any* > | comparison< any 'in' node=any any*> cCs|jdkrtSi}|jjdk rg|jj|jj|ƒrg|d|krg|djtkS|jj|j|ƒoŒ|d|kS(NRtfunc(tparentR tFalsetp1tmatchRRtp2(R RR((s0/usr/lib64/python2.7/lib2to3/fixes/fix_xrange.pyR?s(t__name__t __module__tTruet BM_compatibletPATTERNRRRRRtP1Rtcompile_patternR'tP2R)R(((s0/usr/lib64/python2.7/lib2to3/fixes/fix_xrange.pyR s    N( t__doc__tRt fixer_utilRRRRtBaseFixR(((s0/usr/lib64/python2.7/lib2to3/fixes/fix_xrange.pyts