Hacked By AnonymousFox

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



���]�&�@s�ddlmZddlmZmZddlmZmZeZeZ	ej
ZeZdZ
dZdZGdd�de�Zdd	d
�Zdd�Zd
d�ZdS)�)�pytree)�grammar�token)�pattern_symbols�python_symbols��c@sReZdZdddd�Zdd�Zdd�Zdd	�Zd
d�ZdS)�MinNodeNcCsC||_||_g|_d|_d|_g|_g|_dS)NF)�type�name�children�leaf�parent�alternatives�group)�selfr
r�r�./opt/alt/python35/lib64/python3.5/btm_utils.py�__init__s						zMinNode.__init__cCst|j�dt|j�S)N� )�strr
r)rrrr�__repr__szMinNode.__repr__cCsO|}g}x<|rJ|jtkr�|jj|�t|j�t|j�kr|t|j�g}g|_|j}qn|j}d}P|jtkr|j	j|�t|j	�t|j�kr�t
|j	�}g|_	|j}qn|j}d}P|jtjkr.|j
r.|j|j
�n|j|j�|j}qW|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_rootcCs1x*|j�D]}|j�}|r
|Sq
WdS)N)�leavesr")r�lr!rrr�get_linear_subpatternKszMinNode.get_linear_subpatternccs5x |jD]}|j�EdHq
W|js1|VdS)N)rr#)r�childrrrr#`s	zMinNode.leaves)�__name__�
__module__�__qualname__rrr"r%r#rrrrr	s
	*r	Nc
Cs�d}|jtjkr%|jd}|jtjkr�t|j�dkret|jd|�}q�tdt�}xa|jD]J}|jj	|�dr�q~t||�}|dk	r~|jj
|�q~Wn	|jtjkrit|j�dkrPtdt�}x6|jD]+}t||�}|r|jj
|�qW|jsfd}q�t|jd|�}no|jtj
kr�t|jdtj�r�|jdjdkr�t|jd|�St|jdtj�r�|jdjdks.t|j�dkr2t|jdd�r2|jdjdkr2dSd}d}d}d	}d}	d	}
x�|jD]�}|jtjkr�d	}|}n9|jtjkr�d}|}	n|jtjkr�|}t|d�r`|jd
kr`d}
q`W|
r)|jd}t|d�r6|jdkr6|jd}n
|jd}|jtjkr�|jdkritdt�}q9tt|j�r�tdtt|j��}q9tdtt|j��}n�|jtjkr|jjd
�}|tkr�tdt|�}q9tdtjd|�}n!|jtjkr9t||�}|r}|	jdjdkr^d}n|	jdjdkrwnt�|r�|dk	r�xF|jdd�D]1}t||�}|dk	r�|jj
|�q�W|r�||_|S)N�rr
r�(�[�valueTF�=r�any�'r�*�+���)r
�symsZMatcherrZAlternativesr�reduce_treer	r�indexrZAlternativerZUnit�
isinstancerZLeafr-�hasattrZDetailsZRepeaterrr�TYPE_ANY�getattr�pysyms�STRING�strip�tokens�NotImplementedErrorr)
r rZnew_noder&Zreducedr
Zdetails_nodeZalternatives_nodeZhas_repeaterZ
repeater_nodeZhas_variable_nameZ	name_leafrrrrr5gs�
				


		r5cs/t|t�s|St|�dkr-|dSg}g}dddddg�g}d�x�|D]�}tt|d	d
���ratt|�fdd
���r�|j|�qatt|�fdd
���r�|j|�qa|j|�qaW|r|}n|r|}n|r|}t|d
t�S)Nrr*�in�for�if�not�Nonez[]().,:cSst|�tkS)N)r
r)�xrrr�<lambda>�sz/get_characteristic_subpattern.<locals>.<lambda>cst|t�o|�kS)N)r7r)rE)�common_charsrrrFscst|t�o|�kS)N)r7r)rE)�common_namesrrrFs�key)r7�listrr/�rec_testr�max)ZsubpatternsZsubpatterns_with_namesZsubpatterns_with_common_namesZsubpatterns_with_common_chars�
subpatternr)rGrHrr�s2
				rccsJxC|D];}t|ttf�r7t||�EdHq||�VqWdS)N)r7rJrrK)ZsequenceZ	test_funcrErrrrKs
rKr3������)�rZpgen2rrZpygramrrr4r;Zopmapr>rr9rr�objectr	r5rrKrrrr�<module>s	W�%

Hacked By AnonymousFox1.0, Coded By AnonymousFox