MINI MINI MANI MO
3
\H ã @ s2 d Z ddlmZ ddlmZ G dd„ dejƒZdS )a, Fixer that cleans up a tuple argument to isinstance after the tokens
in it were fixed. This is mainly used to remove double occurrences of
tokens as a leftover of the long -> int / unicode -> str conversion.
eg. isinstance(x, (int, long)) -> isinstance(x, (int, int))
-> isinstance(x, int)
é )Ú
fixer_base)Útokenc @ s e Zd ZdZdZdZdd„ ZdS )Ú
FixIsinstanceTz˜
power<
'isinstance'
trailer< '(' arglist< any ',' atom< '('
args=testlist_gexp< any+ >
')' > > ')' >
>
é c C sú t ƒ }|d }|j}g }t|ƒ}xx|D ]p\}} | jtjkrt| j|krt|t|ƒd k r–||d jtjkr–t |ƒ q&q&|j
| ƒ | jtjkr&|j| jƒ q&W |r´|d jtjkr´|d= t|ƒdkrâ|j}
|
j
|d _
|
j|d ƒ n||d d …<