Viewing File: /opt/alt/python35/lib64/python3.5/lib2to3/fixes/__pycache__/fix_next.cpython-35.opt-1.pyc



¯ÕYffã@s™dZddlmZddlmZddlmZddlm	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 bindingcs@eZdZdZdZdZ‡fdd†Zdd„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* >
    ZprecsWtt|ƒj||ƒtd|ƒ}|rJ|j|tƒd|_n	d|_dS)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_treecCse|jdƒ}|jdƒ}|jdƒ}|r£|jr[|jtdd|jƒƒqadd„|Dƒ}d|d	_|jttd
d|jƒ|ƒƒn¾|rÎtdd|jƒ}|j|ƒn“|r<t|ƒr&|d}djdd„|Dƒƒjƒd
kr"|j	|t
ƒdS|jtdƒƒn%d|kra|j	|t
ƒd|_dS)NÚbaseÚattrÚnameÚ__next__ÚprefixcSsg|]}|jƒ‘qSr)Zclone)Ú.0rrrrú
<listcomp>9s	z%FixNext.transform.<locals>.<listcomp>Úér	ÚheadcSsg|]}t|ƒ‘qSr)Ústr)rrrrrrEs	Z__builtin__ÚglobalT)ÚgetrÚreplacerrrÚis_assign_targetÚjoinÚstriprr
)rÚnodeZresultsrrrrrrrrÚ	transform.s,	
(
(zFixNext.transform)Ú__name__Ú
__module__Ú__qualname__Z
BM_compatibleZPATTERNÚorderrr'rr)rrrs

rcCs]t|ƒ}|dkrdSx:|jD]/}|jtjkrBdSt||ƒr&dSq&WdS)NFT)Úfind_assignÚchildrenÚtyperÚEQUALÚ
is_subtree)r&ZassignZchildrrrr#Qsr#cCsH|jtjkr|S|jtjks7|jdkr;dSt|jƒS)N)r.ÚsymsZ	expr_stmtZsimple_stmtÚparentr,)r&rrrr,]s
!r,cs0|ˆkrdSt‡fdd†|jDƒƒS)NTc3s|]}t|ˆƒVqdS)N)r0)rÚc)r&rrú	<genexpr>gszis_subtree.<locals>.<genexpr>)Úanyr-)Úrootr&r)r&rr0dsr0N)Ú__doc__Zpgen2rZpygramrr1rrZ
fixer_utilrrrr
ZBaseFixrr#r,r0rrrrÚ<module>s@
Back to Directory File Manager