Your IP : 3.149.29.190


Current Path : /opt/alt/python39/lib64/python3.9/lib2to3/fixes/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/lib2to3/fixes/__pycache__/fix_next.cpython-39.opt-1.pyc

a

R�ff�@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__��;/opt/alt/python39/lib64/python3.9/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|vr�|�	|t
�d|_dS)N�base�attr�name�__next__)�prefixcSsg|]}|���qSr)Zclone��.0rrrr�
<listcomp>9�z%FixNext.transform.<locals>.<listcomp>��r	�headcSsg|]}t|��qSr)�strrrrrrErZ__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|�}|durdS|jD]&}|jtjkr0dSt||�rdSqdS)NFT)�find_assign�children�typer�EQUAL�
is_subtree)r)Zassign�childrrrr&Qs

r&cCs4|jtjkr|S|jtjks&|jdur*dSt|j�S�N)r2�symsZ	expr_stmtZsimple_stmt�parentr0�r)rrrr0]s
r0cs$|�krdSt�fdd�|jD��S)NTc3s|]}t|��VqdSr6)r4)r�cr9rr�	<genexpr>grzis_subtree.<locals>.<genexpr>)�anyr1)�rootr)rr9rr4dsr4N)�__doc__Zpgen2rZpygramrr7rrZ
fixer_utilrrrr
ZBaseFixrr&r0r4rrrr�<module>s@

?>