Your IP : 18.224.38.176


Current Path : /opt/alt/python310/lib64/python3.10/lib2to3/fixes/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/lib2to3/fixes/__pycache__/fix_next.cpython-310.opt-1.pyc

o

6��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|�}|r|�|t�d|_dSd|_dS)N�nextTF)�superr�
start_treer�warning�bind_warning�
shadowed_next)�selfZtree�filename�n��	__class__��=/opt/alt/python310/lib64/python3.10/lib2to3/fixes/fix_next.pyr$s


zFixNext.start_treecCs
|�d�}|�d�}|�d�}|r;|jr |�td|jd��dSdd�|D�}d|d	_|�ttd
|jd�|��dS|rKtd|jd�}|�|�dS|rtt|�rk|d}d�dd�|D����d
kri|�	|t
�dS|�td��dSd|vr�|�	|t
�d|_dSdS)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_compatibleZPATTERNZorderrr*�
__classcell__rrrrrs
rcCsFt|�}|dur
dS|jD]}|jtjkrdSt||�r dSq
dS)NFT)�find_assign�children�typer�EQUAL�
is_subtree)r)Zassign�childrrrr&Qs

�r&cCs4|jtjkr|S|jtjks|jdurdSt|j�S�N)r1�symsZ	expr_stmtZsimple_stmt�parentr/�r)rrrr/]s

r/cs$|�krdSt�fdd�|jD��S)NTc3s�|]}t|��VqdSr5)r3)r�cr8rr�	<genexpr>gs�zis_subtree.<locals>.<genexpr>)�anyr0)�rootr)rr8rr3dsr3N)�__doc__Zpgen2rZpygramrr6rrZ
fixer_utilrrrr
ZBaseFixrr&r/r3rrrr�<module>s@

?>