| Server IP : 193.86.120.172 / Your IP : 216.73.216.67 Web Server : Apache/2.4.63 (Unix) System : Linux JServices 3.10.108 #86003 SMP Wed Oct 22 13:20:46 CST 2025 x86_64 User : kubec ( 1026) PHP Version : 8.2.28 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /lib/python3.8/lib2to3/__pycache__/ |
Upload File : |
U
���מ7� @ s| d Z ddlmZ ddlmZmZ ddlmZmZ eZ eZ
ejZeZ
dZdZdZG dd � d e�Zddd�Zd
d� Zdd� Zd
S )z0Utility functions used by the btm_matcher module� )�pytree)�grammar�token)�pattern_symbols�python_symbols���������c @ s: e Zd ZdZd
dd�Zdd� Zdd� Zd d
� Zdd� ZdS )�MinNodez�This class serves as an intermediate representation of the
pattern tree during the conversion to sets of leaf-to-root
subpatternsNc C s. || _ || _g | _d| _d | _g | _g | _d S )NF)�type�name�children�leaf�parent�alternatives�group)�selfr r � r �</tmp/_install_python3/usr/lib/python3.8/lib2to3/btm_utils.py�__init__ s zMinNode.__init__c C s t | j�d t | j� S )N� )�strr r )r r r r �__repr__ s zMinNode.__repr__c C s� | }g }|r�|j tkr^|j�|� t|j�t|j�krRt|j�g}g |_|j}qn|j}d}q�|j tkr�|j �|� t|j �t|j�kr�t
|j �}g |_ |j}qn|j}d}q�|j tjkr�|j
r�|�|j
� n|�|j � |j}q|S )z�Internal method. Returns a characteristic path of the
pattern tree. This method must be run for all leaves until the
linear subpatterns are merged into a singleN)r �TYPE_ALTERNATIVESr �append�lenr
�tupler �
TYPE_GROUPr �get_characteristic_subpattern�token_labels�NAMEr )r �node�subpr r r �leaf_to_root! s8
zMinNode.leaf_to_rootc C s&