Your IP : 18.191.116.61


Current Path : /opt/alt/python34/lib64/python3.4/lib2to3/fixes/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/lib2to3/fixes/__pycache__/fix_xrange.cpython-34.pyc

�
j f�
�@s_dZddlmZddlmZmZmZddlmZGdd�dej�Z	dS)z/Fixer that changes xrange(...) into range(...).�)�
fixer_base)�Name�Call�consuming_calls)�patcompcs�eZdZdZdZ�fdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
Z
eje
�Z
dZeje�Zdd�Z�S)�	FixXrangeTz�
              power<
                 (name='range'|name='xrange') trailer< '(' args=any ')' >
              rest=any* >
              cs)tt|�j||�t�|_dS)N)�superr�
start_tree�set�transformed_xranges)�self�tree�filename)�	__class__��=/opt/alt/python34/lib64/python3.4/lib2to3/fixes/fix_xrange.pyr	szFixXrange.start_treecCs
d|_dS)N)r)rr
rrrr�finish_treeszFixXrange.finish_treecCs^|d}|jdkr)|j||�S|jdkrH|j||�Stt|���dS)N�nameZxrange�range)�value�transform_xrange�transform_range�
ValueError�repr)r�node�resultsrrrr�	transforms
zFixXrange.transformcCs@|d}|jtdd|j��|jjt|��dS)Nrr�prefix)�replacerrr�add�id)rrrrrrrr$s
zFixXrange.transform_xrangecCs�t|�|jkr�|j|�r�ttd�|dj�g�}ttd�|gd|j�}x|dD]}|j|�qsW|SdS)Nr�args�listr�rest)r r�in_special_contextrrZclonerZappend_child)rrrZ
range_callZ	list_call�nrrrr*s"zFixXrange.transform_rangez3power< func=NAME trailer< '(' node=any ')' > any* >z�for_stmt< 'for' any 'in' node=any ':' any* >
            | comp_for< 'for' any 'in' node=any any* >
            | comparison< any 'in' node=any any*>
         cCs�|jdkrdSi}|jjdk	rg|jj|jj|�rg|d|krg|djtkS|jj|j|�o�|d|kS)NFr�func)�parent�p1�matchrr�p2)rrrrrrr$?szFixXrange.in_special_context)�__name__�
__module__�__qualname__Z
BM_compatibleZPATTERNr	rrrrZP1rZcompile_patternr(ZP2r*r$rr)rrrs	rN)
�__doc__�rZ
fixer_utilrrrrZBaseFixrrrrr�<module>s

?>