ok

Mini Shell

Direktori : /opt/alt/python38/lib64/python3.8/lib2to3/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/lib2to3/__pycache__/btm_utils.cpython-38.opt-2.pyc

U

.��c�&�@sxddlmZddlmZmZddlmZmZeZeZ	ej
ZeZdZ
dZdZGdd�de�Zdd
d�Zdd
�Zdd�Zd	S)�)�pytree)�grammar�token)�pattern_symbols�python_symbols���������c@s6eZdZddd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�MinNodeNcCs.||_||_g|_d|_d|_g|_g|_dS)NF)�type�name�children�leaf�parent�alternatives�group)�selfrr�r�6/opt/alt/python38/lib64/python3.8/lib2to3/btm_utils.py�__init__szMinNode.__init__cCst|j�dt|j�S)N� )�strrr)rrrr�__repr__szMinNode.__repr__cCs�|}g}|r�|jtkr^|j�|�t|j�t|j�krRt|j�g}g|_|j}qn|j}d}q�|jtkr�|j	�|�t|j	�t|j�kr�t
|j	�}g|_	|j}qn|j}d}q�|jtjkr�|j
r�|�|j
�n|�|j�|j}q|S�N)r�TYPE_ALTERNATIVESr�append�lenr
�tupler�
TYPE_GROUPr�get_characteristic_subpattern�token_labels�NAMEr)r�node�subprrr�leaf_to_root!s8


zMinNode.leaf_to_rootcCs&|��D]}|��}|r|SqdSr)�leavesr$)r�lr#rrr�get_linear_subpatternKszMinNode.get_linear_subpatternccs*|jD]}|��EdHq|js&|VdSr)r
r%)r�childrrrr%`s
zMinNode.leaves)NN)�__name__�
__module__�__qualname__rrr$r'r%rrrrr
s

	*r
Nc
Cs�d}|jtjkr|jd}|jtjkr�t|j�dkrFt|jd|�}nFttd�}|jD]4}|j�	|�drlqVt||�}|dk	rV|j�
|�qV�n|jtjkr�t|j�dkr�ttd�}|jD]}t||�}|r�|j�
|�q�|js�d}nt|jd|�}�n�|jtj
k�r�t|jdtj��r>|jdjdk�r>t|jd|�St|jdtj��rd|jdjdk�s�t|j�dk�r�t|jdd��r�|jdjdk�r�dSd}d}d}d	}d}	d	}
|jD]d}|jtjk�r�d	}|}n*|jtjk�r�d}|}	n|jtjk�r|}t|d��r�|jd
k�r�d}
�q�|
�rT|jd}t|d��r^|jdk�r^|jd}n
|jd}|jtjk�r�|jdk�r�ttd�}n4tt|j��r�ttt|j�d�}nttt|j�d�}n\|jtjk�r�|j�d
�}|tk�r�tt|d�}nttj|d�}n|jtjk�rt||�}|�rL|	jdjdk�r4d}n|	jdjdk�rHnt�|�r�|dk	�r�|jdd�D]&}t||�}|dk	�rj|j�
|��qj|�r�||_|S)N��)rr�(�[�valueTF�=��any�')rr�*�+r)r�symsZMatcherr
ZAlternativesr�reduce_treer
r�indexrZAlternativerZUnit�
isinstancerZLeafr0�hasattrZDetailsZRepeaterr r!�TYPE_ANY�getattr�pysyms�STRING�strip�tokens�NotImplementedErrorr)
r"rZnew_noder(ZreducedrZdetails_nodeZalternatives_nodeZhas_repeaterZ
repeater_nodeZhas_variable_nameZ	name_leafrrrrr8gs�






�����






r8cs�t|t�s|St|�dkr"|dSg}g}dddddg�g}d�|D]d}tt|d	d
���rDtt|�fdd
���r||�|�qDtt|�fdd
���r�|�|�qD|�|�qD|r�|}n|r�|}n|r�|}t|td
�S)Nrr,�in�for�if�not�Nonez[]().,:cSst|�tkSr)rr��xrrr�<lambda>��z/get_characteristic_subpattern.<locals>.<lambda>cst|t�o|�kSr�r:rrH)�common_charsrrrJrKcst|t�o|�kSrrLrH)�common_namesrrrJrK)�key)r:�listrr3�rec_testr�max)ZsubpatternsZsubpatterns_with_namesZsubpatterns_with_common_namesZsubpatterns_with_common_chars�
subpatternr)rMrNrr�s6

�
�rccs8|D].}t|ttf�r(t||�EdHq||�VqdSr)r:rPrrQ)ZsequenceZ	test_funcrIrrrrQsrQ)N)�rZpgen2rrZpygramrrr7r>ZopmaprAr r<rr�objectr
r8rrQrrrr�<module>sW
%

Zerion Mini Shell 1.0