AlkantarClanX12

Your IP : 13.59.112.169


Current Path : /proc/self/root/opt/alt/python35/lib64/python3.5/lib2to3/fixes/__pycache__/
Upload File :
Current File : //proc/self/root/opt/alt/python35/lib64/python3.5/lib2to3/fixes/__pycache__/fix_next.cpython-35.pyc



��Yff�@s�dZddlmZddlmZddlmZddlm	Z	m
Z
mZdZGdd�dej
�Zd	d
�Zdd�Zd
d�ZdS)z.Fixer for it.next() -> next(it), per PEP 3114.�)�token)�python_symbols)�
fixer_base)�Name�Call�find_bindingz;Calls to builtin next() possibly shadowed by global bindingcs@eZdZdZdZdZ�fdd�Zdd�Z�S)�FixNextTa�
    power< base=any+ trailer< '.' attr='next' > trailer< '(' ')' > >
    |
    power< head=any+ trailer< '.' attr='next' > not trailer< '(' ')' > >
    |
    classdef< 'class' any+ ':'
              suite< any*
                     funcdef< 'def'
                              name='next'
                              parameters< '(' NAME ')' > any+ >
                     any* > >
    |
    global=global_stmt< 'global' any* 'next' any* >
    ZprecsWtt|�j||�td|�}|rJ|j|t�d|_n	d|_dS)N�nextTF)�superr�
start_treer�warning�bind_warning�
shadowed_next)�selfZtree�filename�n)�	__class__��;/opt/alt/python35/lib64/python3.5/lib2to3/fixes/fix_next.pyr$szFixNext.start_treecCsq|st�|jd�}|jd�}|jd�}|r�|jrg|jtdd|j��qmdd�|D�}d|d	_|jttd
d|j�|��n�|r�tdd|j�}|j|�n�|rHt|�r2|d}djdd�|D��j	�d
kr.|j
|t�dS|jtd��n%d|krm|j
|t�d|_dS)N�base�attr�name�__next__�prefixcSsg|]}|j��qSr)Zclone)�.0rrrr�
<listcomp>9s	z%FixNext.transform.<locals>.<listcomp>��r	�headcSsg|]}t|��qSr)�str)rrrrrrEs	Z__builtin__�globalT)�AssertionError�getr�replacerrr�is_assign_target�join�striprr
)r�nodeZresultsrrrrrrrr�	transform.s.	
(
(zFixNext.transform)�__name__�
__module__�__qualname__Z
BM_compatibleZPATTERN�orderrr(rr)rrrs

rcCs]t|�}|dkrdSx:|jD]/}|jtjkrBdSt||�r&dSq&WdS)NFT)�find_assign�children�typer�EQUAL�
is_subtree)r'ZassignZchildrrrr$Qsr$cCsH|jtjkr|S|jtjks7|jdkr;dSt|j�S)N)r/�symsZ	expr_stmtZsimple_stmt�parentr-)r'rrrr-]s
!r-cs0|�krdSt�fdd�|jD��S)NTc3s|]}t|��VqdS)N)r1)r�c)r'rr�	<genexpr>gszis_subtree.<locals>.<genexpr>)�anyr.)�rootr'r)r'rr1dsr1N)�__doc__Zpgen2rZpygramrr2rrZ
fixer_utilrrrr
ZBaseFixrr$r-r1rrrr�<module>s@