Hacked By AnonymousFox
o
6��ff � @ sn d Z ddlmZ ddlmZ ddlmZ ddlm Z m
Z
mZ dZG dd� 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 bindingc s0 e Zd ZdZdZdZ� 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* >
Zprec s@ t t| ��||� td|�}|r| �|t� d| _d S d| _d S )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_treec C s
|� d�}|� d�}|� d�}|r;| jr |�td|jd�� d S dd� |D �}d|d _|�ttd
|jd�|�� d S |rKtd|jd�}|�|� d S |rtt|�rk|d }d�dd� |D ���� d
kri| � |t
� d S |�td�� d S d|v r�| � |t
� d| _d S d S )N�base�attr�name�__next__)�prefixc S s g | ]}|� � �qS r )Zclone��.0r r r r �
<listcomp>9 � z%FixNext.transform.<locals>.<listcomp>� � r �headc S s g | ]}t |��qS r )�strr r r r r E r Z__builtin__�globalT)�getr �replacer r r �is_assign_target�join�stripr r
)r �nodeZresultsr r r r r! r r r � transform. s.
�zFixNext.transform) �__name__�
__module__�__qualname__Z
BM_compatibleZPATTERNZorderr r* �
__classcell__r r r r r s
r c C sF t | �}|d u r
dS |jD ]}|jtjkr dS t|| �r dS q
dS )NFT)�find_assign�children�typer �EQUAL�
is_subtree)r) Zassign�childr r r r&