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



й¼]fã@s“ddlmZddlmZddlmZddlmZm	Z	m
Z
dZGdd„dejƒZ
dd	„Zd
d„Zdd
„ZdS)é)Ú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* >
    ÚprecsWtt|ƒ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/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	Ú__builtin__ÚglobalT)ÚgetrÚreplacerrrÚis_assign_targetÚjoinÚstripr
r)rÚnodeÚresultsrrrrrrrrÚ	transform.s,	
(
(zFixNext.transform)Ú__name__Ú
__module__Ú__qualname__Z
BM_compatibleZPATTERNÚorderrr*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)r1ÚsymsZ	expr_stmtZsimple_stmtÚparentr/)r(rrrr/]s
!r/cs0|ˆkrdSt‡fdd†|jDƒƒS)NTc3s|]}t|ˆƒVqdS)N)r3)rÚc)r(rrú	<genexpr>gszis_subtree.<locals>.<genexpr>)Úanyr0)Úrootr(r)r(rr3dsr3N)Zpgen2rZpygramrr4rrZ
fixer_utilrrrrZBaseFixrr%r/r3rrrrÚ<module>	s@
Back to Directory File Manager