Your IP : 3.141.32.252
��Yff � @ s� d Z d d l m Z d d l m Z d d l m Z d d l m Z m
Z
m Z d Z Gd d � d e j
� Z d d
� Z d d � Z d
d � Z d S)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 s@ e Z d Z d Z d Z d Z � f d d � Z d d � Z � S)�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 sW t t | � j | | � t d | � } | rJ | j | t � d | _ n d | _ d S)N�nextTF)�superr �
start_treer �warning�bind_warning�
shadowed_next)�selfZtree�filename�n)� __class__� �;/opt/alt/python35/lib64/python3.5/lib2to3/fixes/fix_next.pyr $ s zFixNext.start_treec C se | j d � } | j d � } | j d � } | r� | j r[ | j t d d | j �� qad d � | D� } d | d _ | j t t d
d | j �| � � n� | r� t d d | j �} | j | � n� | r<t | � r&| d } d j d d � | D� � j � d
k r"| j | t
� d S| j t d � � n% d | k ra| j | t
� d | _ d S)N�base�attr�name�__next__�prefixc S s g | ] } | j � � q Sr )Zclone)�.0r r r r �
<listcomp>9 s z%FixNext.transform.<locals>.<listcomp>� � r �headc S s g | ] } t | � � q Sr )�str)r r r r r r E s 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_compatibleZPATTERN�orderr r'