U AT^f @sjddlmZddlmZddlmZddlmZm Z m Z dZ Gdddej Z dd Zd d Zd d ZdS))token)python_symbols) fixer_base)NameCall find_bindingz;Calls to builtin next() possibly shadowed by global bindingcs0eZdZdZdZdZfddZddZZS)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* > precs>tt|||td|}|r4||td|_nd|_dS)NnextTF)superr start_treerwarning bind_warning shadowed_next)selfZtreefilenamen __class__./usr/lib64/python3.8/lib2to3/fixes/fix_next.pyr $s   zFixNext.start_treecCs|d}|d}|d}|rr|jr>|td|jdqdd|D}d|d _|ttd |jd|n|rtd|jd}||nj|rt|r|d }dd d|Dd kr| |t dS|tdnd|kr| |t d|_dS)Nbaseattrname__next__)prefixcSsg|] }|qSr)Zclone.0rrrr 9sz%FixNext.transform..r headcSsg|] }t|qSr)strrrrrrEs __builtin__globalT) getrreplacerrris_assign_targetjoinstripr r)rnoderesultsrrrrr!rrr transform.s,       zFixNext.transform) __name__ __module__ __qualname__Z BM_compatibleZPATTERNorderr r, __classcell__rrrrrs  rcCsFt|}|dkrdS|jD]&}|jtjkr0dSt||rdSqdS)NFT) find_assignchildrentyperEQUAL is_subtree)r*ZassignZchildrrrr'Qs   r'cCs4|jtjkr|S|jtjks&|jdkr*dSt|jSN)r4symsZ expr_stmtZ simple_stmtparentr2r*rrrr2]s  r2cs$|kr dStfdd|jDS)NTc3s|]}t|VqdSr7)r6)rcr:rr gszis_subtree..)anyr3)rootr*rr:rr6dsr6N)Zpgen2rZpygramrr8rrZ fixer_utilrrrrZBaseFixrr'r2r6rrrr s   @