ok

Mini Shell

Direktori : /opt/alt/python35/lib64/python3.5/lib2to3/fixes/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/lib2to3/fixes/__pycache__/fix_isinstance.cpython-35.pyc



K�MaH�@sCdZddlmZddlmZGdd�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.eZdZdZdZdZdd�ZdS)�
FixIsinstanceTz�
    power<
        'isinstance'
        trailer< '(' arglist< any ',' atom< '('
            args=testlist_gexp< any+ >
        ')' > > ')' >
    >
    �cCsUt�}|d}|j}g}t|�}x�|D]�\}}	|	jtjkr�|	j|kr�|t|�dkr�||djtjkr�t	|�q5q5|j
|	�|	jtjkr5|j|	j�q5W|r�|djtjkr�|d=t|�dkr7|j}
|
j
|d_
|
j|d�n||dd�<|j�dS)N�args�����r	)�setZchildren�	enumerate�typer�NAME�value�len�COMMA�next�append�add�parent�prefix�replaceZchanged)�selfZnodeZresultsZnames_insertedZtestlistrZnew_args�iterator�idx�argZatom�r�A/opt/alt/python35/lib64/python3.5/lib2to3/fixes/fix_isinstance.py�	transforms*	
	!0

	zFixIsinstance.transformN)�__name__�
__module__�__qualname__Z
BM_compatibleZPATTERNZ	run_orderrrrrrrsrN)�__doc__�rZ
fixer_utilrZBaseFixrrrrr�<module>
s

Zerion Mini Shell 1.0