AlkantarClanX12
Current Path : /proc/self/root/usr/lib64/python3.6/lib2to3/fixes/__pycache__/ |
Current File : //proc/self/root/usr/lib64/python3.6/lib2to3/fixes/__pycache__/fix_xrange.cpython-36.opt-2.pyc |
3 \� � @ sB d dl mZ d dlmZmZmZ d dl mZ G dd� dej�ZdS )� )� fixer_base)�Name�Call�consuming_calls)�patcompc sh e Zd ZdZdZ� fdd�Zdd� Zdd� Zd d � Zdd� Z d Z eje �Z dZeje�Zdd� Z� ZS )� FixXrangeTz� power< (name='range'|name='xrange') trailer< '(' args=any ')' > rest=any* > c s t t| �j||� t� | _d S )N)�superr � start_tree�set�transformed_xranges)�self�tree�filename)� __class__� �0/usr/lib64/python3.6/lib2to3/fixes/fix_xrange.pyr s zFixXrange.start_treec C s d | _ d S )N)r )r r r r r r �finish_tree s zFixXrange.finish_treec C sD |d }|j dkr| j||�S |j dkr4| j||�S tt|���d S )N�nameZxrange�range)�value�transform_xrange�transform_range� ValueError�repr)r �node�resultsr r r r � transform s zFixXrange.transformc C s0 |d }|j td|jd�� | jjt|�� d S )Nr r )�prefix)�replacer r r �add�id)r r r r r r r r $ s zFixXrange.transform_xrangec C sl t |�| jkrh| j|� rhttd�|d j� g�}ttd�|g|jd�}x|d D ]}|j|� qRW |S d S )Nr �args�list)r �rest)r r �in_special_contextr r Zcloner Zappend_child)r r r Z range_callZ list_call�nr r r r * 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*> c C sf |j d krdS i }|j j d k rJ| jj|j j |�rJ|d |krJ|d jtkS | jj|j |�od|d |kS )NFr �func)�parent�p1�matchr r �p2)r r r r r r r$ ? s zFixXrange.in_special_context)�__name__� __module__�__qualname__Z BM_compatibleZPATTERNr r r r r ZP1r Zcompile_patternr( ZP2r* r$ � __classcell__r r )r r r s r N) � r Z fixer_utilr r r r ZBaseFixr r r r r �<module> s