Spade
Mini Shell
| Directory:~$ /proc/self/root/usr/lib/python2.7/site-packages/libfuturize/fixes/ |
| [Home] [System Details] [Kill Me] |
�
,�]c@s�dZddlmZddlmZddlmZddlm Z m
Z
mZdZdej
fd��YZd �Zd
�Zd�ZdS(
s
Based on fix_next.py by Collin Winter.
Replaces it.next() -> next(it), per PEP 3114.
Unlike fix_next.py, this fixer doesn't replace the name of a next
method with __next__,
which would break Python 2 compatibility without further help from fixers
in
stage 2.
i����(ttoken(tpython_symbols(t
fixer_base(tNametCalltfind_bindings;Calls to builtin next() possibly
shadowed by global
bindingtFixNextCallcBs,eZeZdZdZd�Zd�ZRS(s�
power< base=any+ trailer< '.' attr='next'
> trailer< '(' ')' > >
|
power< head=any+ trailer< '.' attr='next'
> not trailer< '(' ')' > >
|
global=global_stmt< 'global' any* 'next' any*
>
tprecCsWtt|�j||�td|�}|rJ|j|t�t|_n t|_dS(Ntnext( tsuperRt
start_treeRtwarningtbind_warningtTruet
shadowed_nexttFalse(tselfttreetfilenametn((sC/usr/lib/python2.7/site-packages/libfuturize/fixes/fix_next_call.pyR
scCs2|jd�}|jd�}|jd�}|r�|jr?q.g|D]}|j�^qF}d|d_|jttdd|j�|��n�|r�n�|rt|�r.|d}djg|D]}t |�^q��j
�d kr�|j|t�ndSn(d
|kr.|j|t�t
|_ndS(NtbasetattrtnametiRtprefixtheadt__builtin__tglobal(tgetRtcloneRtreplaceRRtis_assign_targettjointstrtstripRRR
(RtnodetresultsRRRRR((sC/usr/lib/python2.7/site-packages/libfuturize/fixes/fix_next_call.pyt transform*s(
(
4(t__name__t
__module__R
t
BM_compatibletPATTERNtorderR
R%(((sC/usr/lib/python2.7/site-packages/libfuturize/fixes/fix_next_call.pyRs
cCs]t|�}|dkrtSx:|jD]/}|jtjkrBtSt||�r&tSq&WtS(N( tfind_assigntNoneRtchildrenttypeRtEQUALt
is_subtreeR
(R#tassigntchild((sC/usr/lib/python2.7/site-packages/libfuturize/fixes/fix_next_call.pyRRscCsH|jtjkr|S|jtjks7|jdkr;dSt|j�S(N(R.tsymst expr_stmttsimple_stmttparentR,R+(R#((sC/usr/lib/python2.7/site-packages/libfuturize/fixes/fix_next_call.pyR+^s
!cs-|�krtSt�fd�|jD��S(Nc3s|]}t|��VqdS(N(R0(t.0tc(R#(sC/usr/lib/python2.7/site-packages/libfuturize/fixes/fix_next_call.pys <genexpr>hs(R
tanyR-(trootR#((R#sC/usr/lib/python2.7/site-packages/libfuturize/fixes/fix_next_call.pyR0esN(t__doc__t
lib2to3.pgen2Rtlib2to3.pygramRR3tlib2to3Rtlib2to3.fixer_utilRRRRtBaseFixRRR+R0(((sC/usr/lib/python2.7/site-packages/libfuturize/fixes/fix_next_call.pyt<module> s>