AlkantarClanX12

Your IP : 3.144.90.108


Current Path : /lib64/python3.6/lib2to3/fixes/__pycache__/
Upload File :
Current File : //lib64/python3.6/lib2to3/fixes/__pycache__/fix_next.cpython-36.pyc

3


 \f�@sndZddlmZddlmZddlmZddlm	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 bindingcs0eZdZdZdZdZ�fdd�Zdd�Z�ZS)�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* >
    Zprecs>tt|�j||�td|�}|r4|j|t�d|_nd|_dS)N�nextTF)�superr�
start_treer�warning�bind_warning�
shadowed_next)�selfZtree�filename�n)�	__class__��./usr/lib64/python3.6/lib2to3/fixes/fix_next.pyr$s
zFixNext.start_treecCs|st�|jd�}|jd�}|jd�}|rz|jrF|jtd|jd��n2dd�|D�}d|d	_|jttd
|jd�|��n�|r�td|jd�}|j|�nl|r�t|�r�|d}djdd�|D��j	�d
kr�|j
|t�dS|jtd��nd|k�r|j
|t�d|_dS)N�base�attr�name�__next__)�prefixcSsg|]}|j��qSr)Zclone)�.0rrrr�
<listcomp>9sz%FixNext.transform.<locals>.<listcomp>��r	�headcSsg|]}t|��qSr)�str)rrrrrrEsZ__builtin__�globalT)�AssertionError�getr�replacerrr�is_assign_target�join�striprr
)r�nodeZresultsrrrrrrrr�	transform.s.




zFixNext.transform)	�__name__�
__module__�__qualname__Z
BM_compatibleZPATTERN�orderrr(�
__classcell__rr)rrrs

rcCsFt|�}|dkrdSx,|jD]"}|jtjkr0dSt||�rdSqWdS)NFT)�find_assign�children�typer�EQUAL�
is_subtree)r'ZassignZchildrrrr$Qs
r$cCs4|jtjkr|S|jtjks&|jdkr*dSt|j�S)N)r0�symsZ	expr_stmtZsimple_stmt�parentr.)r'rrrr.]s
r.cs$|�krdSt�fdd�|jD��S)NTc3s|]}t|��VqdS)N)r2)r�c)r'rr�	<genexpr>gszis_subtree.<locals>.<genexpr>)�anyr/)�rootr'r)r'rr2dsr2N)�__doc__Zpgen2rZpygramrr3rrZ
fixer_utilrrrr
ZBaseFixrr$r.r2rrrr�<module>s@