U if @sBddlmZddlmZmZmZddlmZGdddejZdS)) fixer_base)NameCallconsuming_calls)patcompcsheZdZdZdZfddZddZddZd d Zd d Z d Z e e Z dZe eZddZZS) FixXrangeTz power< (name='range'|name='xrange') trailer< '(' args=any ')' > rest=any* > cstt|||t|_dSN)superr start_treesettransformed_xrangesselfZtreefilename __class__=/opt/alt/python38/lib64/python3.8/lib2to3/fixes/fix_xrange.pyr szFixXrange.start_treecCs d|_dSr)r r rrr finish_treeszFixXrange.finish_treecCsD|d}|jdkr|||S|jdkr4|||Stt|dS)NnameZxrangerange)valuetransform_xrangetransform_range ValueErrorreprrnoderesultsrrrr transforms     zFixXrange.transformcCs0|d}|td|jd|jt|dS)Nrrprefix)replacerr!r addidrrrrr$szFixXrange.transform_xrangecCsft||jkrb||sbttd|dg}ttd|g|jd}|dD]}||qN|SdS)Nrargslistr rest)r$r in_special_contextrrZcloner!Z append_child)rrrZ range_callZ list_callnrrrr*s   zFixXrange.transform_rangez3power< func=NAME trailer< '(' node=any ')' > any* >zfor_stmt< 'for' any 'in' node=any ':' any* > | comp_for< 'for' any 'in' node=any any* > | comparison< any 'in' node=any any*> cCsf|jdkrdSi}|jjdk rJ|j|jj|rJ|d|krJ|djtkS|j|j|od|d|kS)NFrfunc)parentp1matchrrp2)rrrrrrr(?s   zFixXrange.in_special_context)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr rrrrZP1rZcompile_patternr,ZP2r.r( __classcell__rrrrr s     rN) rZ fixer_utilrrrrZBaseFixrrrrrs