AlkantarClanX12

Your IP : 3.15.7.212


Current Path : /opt/alt/python37/lib64/python3.7/lib2to3/fixes/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/lib2to3/fixes/__pycache__/fix_metaclass.cpython-37.opt-2.pyc

B

YI~d �@srddlmZddlmZddlmZmZmZdd�Zdd�Z	dd	�Z
d
d�Zdd
�Zdd�Z
Gdd�dej�ZdS)�)�
fixer_base)�token)�syms�Node�LeafcCsxxr|jD]h}|jtjkr t|�S|jtjkr|jr|jd}|jtjkr|jr|jd}t|t�r|j	dkrdSqWdS)N��
__metaclass__TF)
�children�typer�suite�
has_metaclass�simple_stmt�	expr_stmt�
isinstancer�value)�parent�node�	expr_nodeZ	left_side�r�@/opt/alt/python37/lib64/python3.7/lib2to3/fixes/fix_metaclass.pyrs



rcCs�x|jD]}|jtjkrdSqWx,t|j�D]\}}|jtjkr,Pq,Wtd��ttjg�}x:|j|dd�r�|j|d}|�	|�
��|��q\W|�	|�|}dS)NzNo class suite and no ':'!�)r	r
rr�	enumerater�COLON�
ValueErrorr�append_child�clone�remove)�cls_noder�ir�	move_noderrr�fixup_parse_tree-s
r c
Cs�x(t|j�D]\}}|jtjkrPqWdS|��ttjg�}ttj	|g�}x2|j|d�r~|j|}|�
|���|��qNW|�||�|jdjd}|jdjd}	|	j
|_
dS)Nr)rr	r
r�SEMIrrrrr
rr�insert_child�prefix)
rrZ	stmt_nodeZsemi_indrZnew_exprZnew_stmtrZ	new_leaf1Z	old_leaf1rrr�fixup_simple_stmtGs
r$cCs*|jr&|jdjtjkr&|jd��dS)N���)r	r
r�NEWLINEr)rrrr�remove_trailing_newline_sr'ccs�x$|jD]}|jtjkrPqWtd��x�tt|j��D]t\}}|jtjkr6|jr6|jd}|jtjkr6|jr6|jd}t	|t
�r6|jdkr6t|||�t
|�|||fVq6WdS)NzNo class suite!rr)r	r
rrr�listrr
rrrrr$r')rrrZsimple_noderZ	left_noderrr�
find_metasds



r)cCs�|jddd�}x|r.|��}|jtjkrPqWxL|r||��}t|t�rd|jtjkrd|jr`d|_dS|�	|jddd��q2WdS)Nr%�)
r	�popr
r�INDENTrr�DEDENTr#�extend)rZkidsrrrr�fixup_indent{sr/c@seZdZdZdZdd�ZdS)�FixMetaclassTz
    classdef<any*>
    cCs<t|�sdSt|�d}x"t|�D]\}}}|}|��q"W|jdj}t|j�dkr�|jdjtjkrt|jd}n(|jd�	�}	t
tj|	g�}|�d|�n�t|j�dkr�t
tjg�}|�d|�nZt|j�dk�rt
tjg�}|�dt
tjd��|�d|�|�dt
tjd��ntd	��|jdjd}
d
|
_|
j}|j�r^|�t
tjd��d|
_nd
|
_|jd}d
|jd_d
|jd_|�|�t|�|j�s�|��t
|d�}
||
_|�|
�|�t
tjd��nbt|j�dk�r8|jdjtjk�r8|jdjtjk�r8t
|d�}
|�d|
�|�dt
tjd��dS)Nr����r�)�(zUnexpected class definition�	metaclass�,� r*r�pass�
���r%)rr r)rr	r
�lenr�arglistrrZ	set_childr"rr�RPAR�LPARrrr#r�COMMAr/r&r,r-)�selfr�resultsZlast_metaclassrrZstmtZ	text_typer>rZmeta_txtZorig_meta_prefixrZ	pass_leafrrr�	transform�s^




zFixMetaclass.transformN)�__name__�
__module__�__qualname__Z
BM_compatibleZPATTERNrDrrrrr0�sr0N)r*rZpygramrZ
fixer_utilrrrrr r$r'r)r/ZBaseFixr0rrrr�<module>s