Your IP : 18.219.239.111


Current Path : /opt/alt/python310/lib64/python3.10/lib2to3/fixes/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/lib2to3/fixes/__pycache__/fix_metaclass.cpython-310.opt-2.pyc

o

6��f �@st	ddlmZddlmZddlmZmZmZdd�Zdd�Z	dd	�Z
d
d�Zdd
�Zdd�Z
Gdd�dej�ZdS)�)�
fixer_base)�token)�syms�Node�LeafcCs|	|jD]7}|jtjkrt|�S|jtjkr;|jr;|jd}|jtjkr;|jr;|jd}t|t�r;|j	dkr;dSqdS)N��
__metaclass__TF)
�children�typer�suite�
has_metaclass�simple_stmt�	expr_stmt�
isinstancer�value)�parent�node�	expr_nodeZ	left_side�r�B/opt/alt/python310/lib64/python3.10/lib2to3/fixes/fix_metaclass.pyrs




�rcCs�	|jD]}|jtjkrdSqt|j�D]\}}|jtjkr!nqtd��ttjg�}|j|dd�rP|j|d}|�	|�
��|��|j|dd�s5|�	|�|}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�	t|j�D]\}}|jtjkrnqdS|��ttjg�}ttj	|g�}|j|d�rD|j|}|�
|���|��|j|d�s-|�||�|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$cCs2|jr|jdjtjkr|jd��dSdSdS)N���)r	r
r�NEWLINEr)rrrr�remove_trailing_newline_s�r'ccs��|jD]
}|jtjkrnqtd��tt|j��D]:\}}|jtjkrT|jrT|jd}|jtjkrT|jrT|jd}t	|t
�rT|jdkrTt|||�t
|�|||fVqdS)NzNo class suite!rr)r	r
rrr�listrr
rrrrr$r')rrrZsimple_noderZ	left_noderrr�
find_metasds$�
�



��r)cCs�	|jddd�}|r|��}|jtjkrn|s|r@|��}t|t�r1|jtjkr1|jr/d|_dS|�	|jddd��|sdSdS)Nr%�)
r	�popr
r�INDENTrr�DEDENTr#�extend)rZkidsrrrr�fixup_indent{s��r/c@seZdZdZdZdd�ZdS)�FixMetaclassTz
    classdef<any*>
    cCs@t|�sdSt|�d}t|�D]\}}}|}|��q|jdj}t|j�dkrM|jdjtjkr8|jd}nU|jd�	�}	t
tj|	g�}|�d|�n@t|j�dkrat
tjg�}|�d|�n,t|j�dkr�t
tjg�}|�dt
tjd��|�d|�|�dt
tjd��ntd	��|jdjd}
d
|
_|
j}|jr�|�t
tjd��d|
_nd
|
_|jd}d
|jd_d
|jd_|�|�t|�|js�|��t
|d�}
||
_|�|
�|�t
tjd��dSt|j�dk�r|jdjtjk�r|jdjtjk�rt
|d�}
|�d|
�|�dt
tjd��dSdSdSdS)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-)�selfrZresultsZlast_metaclassrrZstmtZ	text_typer>rZmeta_txtZorig_meta_prefixrZ	pass_leafrrr�	transform�sd





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

?>