Your IP : 3.138.60.175


Current Path : /lib64/python3.8/lib2to3/fixes/__pycache__/
Upload File :
Current File : //lib64/python3.8/lib2to3/fixes/__pycache__/fix_next.cpython-38.opt-1.pyc

U

e5df�@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|��||�td|�}|r4|�|t�d|_nd|_dS)N�nextTF)�superr�
start_treer�warning�bind_warning�
shadowed_next)�selfZtree�filename�n��	__class__��./usr/lib64/python3.8/lib2to3/fixes/fix_next.pyr$s
zFixNext.start_treecCs�|�d�}|�d�}|�d�}|rr|jr>|�td|jd��q�dd�|D�}d|d	_|�ttd
|jd�|��n�|r�td|jd�}|�|�nj|r�t|�r�|d}d�dd�|D����d
kr�|�	|t
�dS|�td��nd|kr�|�	|t
�d|_dS)N�base�attr�name�__next__)�prefixcSsg|]}|���qSr)Zclone��.0rrrr�
<listcomp>9sz%FixNext.transform.<locals>.<listcomp>��r	�headcSsg|]}t|��qSr)�strrrrrrEsZ__builtin__�globalT)�getr�replacerrr�is_assign_target�join�striprr
)r�nodeZresultsrrrrr rrr�	transform.s,



zFixNext.transform)	�__name__�
__module__�__qualname__Z
BM_compatibleZPATTERN�orderrr)�
__classcell__rrrrrs

rcCsFt|�}|dkrdS|jD]&}|jtjkr0dSt||�rdSqdS)NFT)�find_assign�children�typer�EQUAL�
is_subtree)r(ZassignZchildrrrr%Qs

r%cCs4|jtjkr|S|jtjks&|jdkr*dSt|j�S�N)r1�symsZ	expr_stmtZsimple_stmt�parentr/�r(rrrr/]s
r/cs$|�krdSt�fdd�|jD��S)NTc3s|]}t|��VqdSr4)r3)r�cr7rr�	<genexpr>gszis_subtree.<locals>.<genexpr>)�anyr0)�rootr(rr7rr3dsr3N)�__doc__Zpgen2rZpygramrr5rrZ
fixer_utilrrrr
ZBaseFixrr%r/r3rrrr�<module>s@

?>