Your IP : 18.189.182.15


Current Path : /opt/alt/python35/lib64/python3.5/lib2to3/fixes/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/lib2to3/fixes/__pycache__/fix_metaclass.cpython-35.opt-2.pyc



���] �@s�ddlmZddlmZddlmZmZmZmZdd�Z	dd�Z
dd	�Zd
d�Zdd
�Z
dd�ZGdd�dej�ZdS)�)�
fixer_base)�token)�Name�syms�Node�LeafcCs�x�|jD]�}|jtjkr,t|�S|jtjkr
|jr
|jd}|jtjkr
|jr
|jd}t|t�r
|j	dkr
dSq
WdS)N��
__metaclass__TF)
�children�typer�suite�
has_metaclass�simple_stmt�	expr_stmt�
isinstancer�value)�parent�node�	expr_nodeZ	left_side�r�2/opt/alt/python35/lib64/python3.5/fix_metaclass.pyr
s


r
cCs�x'|jD]}|jtjkr
dSq
Wx<t|j�D]\}}|jtjkr:Pq:Wtd��ttjg�}xI|j|dd�r�|j|d}|j	|j
��|j�q~W|j	|�|}dS)NzNo class suite and no ':'!�)r
rrr�	enumerater�COLON�
ValueErrorr�append_child�clone�remove)�cls_noder�ir�	move_noderrr�fixup_parse_tree-s
r!c
Cs�x4t|j�D]\}}|jtjkrPqWdS|j�ttjg�}ttj	|g�}xA|j|d�r�|j|}|j
|j��|j�qkW|j||�|jdjd}|jdjd}	|	j
|_
dS)Nr)rr
rr�SEMIrrrrrrr�insert_child�prefix)
rrZ	stmt_nodeZsemi_indrZnew_exprZnew_stmtr Z	new_leaf1Z	old_leaf1rrr�fixup_simple_stmtGs

r%cCs7|jr3|jdjtjkr3|jdj�dS)Nr���r&)r
rr�NEWLINEr)rrrr�remove_trailing_newline_s"r(ccs�x0|jD]}|jtjkr
Pq
Wtd��x�tt|j��D]�\}}|jtjkrI|jrI|jd}|jtjkrI|jrI|jd}t	|t
�rI|jdkrIt|||�t
|�|||fVqIWdS)NzNo class suite!rr	)r
rrrr�listrrrrrrr%r()rrrZsimple_noderZ	left_noderrr�
find_metasds"


r*cCs�|jddd�}x)|rA|j�}|jtjkrPqWxj|r�|j�}t|t�r�|jtjkr�|jr�d|_dS|j	|jddd��qEWdS)Nr�r&r&)
r
�poprr�INDENTrr�DEDENTr$�extend)rZkidsrrrr�fixup_indent{s		!		r0c@s(eZdZdZdZdd�ZdS)�FixMetaclassTz
    classdef<any*>
    cCst|�sdSt|�d}x-t|�D]\}}}|}|j�q-W|jdj}t|j�dkr�|jdjtjkr�|jd}q�|jdj	�}	t
tj|	g�}|jd|�n�t|j�dkrt
tjg�}|jd|�n~t|j�dkr�t
tjg�}|jdt
tjd��|jd|�|jdt
tjd��ntd	��|jdjd}
d
|
_|
j}|jr�|jt
tjd��d|
_n	d
|
_|jd}d
|jd_d
|jd_|j|�t|�|js�|j�t
|d�}
||
_|j|
�|jt
tjd��n�t|j�dkr|jdjtjkr|jdjtjkrt
|d�}
|jd|
�|jdt
tjd��dS)Nr����r�)�(zUnexpected class definition�	metaclass�,� r+r�pass�
���r&r&r&)r
r!r*rr
r�lenr�arglistrrZ	set_childr#rr�RPAR�LPARrrr$r�COMMAr0r'r-r.)�selfr�resultsZlast_metaclassrrZstmtZ	text_typer?rZmeta_txtZorig_meta_prefixrZ	pass_leafrrr�	transform�s^
				


	
	
zFixMetaclass.transformN)�__name__�
__module__�__qualname__Z
BM_compatibleZPATTERNrErrrrr1�sr1N)r+rZpygramrZ
fixer_utilrrrrr
r!r%r(r*r0ZBaseFixr1rrrr�<module>s"

?>