$43 GRAYBYTE WORDPRESS FILE MANAGER $51

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 104.21.15.130 | ADMIN IP 216.73.216.51
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/usr/lib64/python3.12/lib2to3/__pycache__/

HOME
Current File : /usr/lib64/python3.12/lib2to3/__pycache__//btm_matcher.cpython-312.opt-1.pyc
�

�֦i���v�dZdZddlZddlZddlmZddlmZddlm	Z	Gd�d	e
�ZGd
�de
�Zia
d�Zy)
a�A bottom-up tree matching algorithm implementation meant to speed
up 2to3's matching process. After the tree patterns are reduced to
their rarest linear path, a linear Aho-Corasick automaton is
created. The linear automaton traverses the linear paths from the
leaves to the root of the AST and returns a set of nodes for further
matching. This reduces significantly the number of candidate nodes.z+George Boutsioukis <[email protected]>�N)�defaultdict�)�pytree)�reduce_treec�8�eZdZdZej
�Zd�Zy)�BMNodez?Class for a node of the Aho-Corasick automaton used in matchingc�j�i|_g|_ttj�|_d|_y)N�)�transition_table�fixers�nextr�count�id�content��selfs �,/usr/lib64/python3.12/lib2to3/btm_matcher.py�__init__zBMNode.__init__s(�� "�������v�|�|�$������N)�__name__�
__module__�__qualname__�__doc__�	itertoolsrr�rrrrs��I��I�O�O��E�rrc�.�eZdZdZd�Zd�Zd�Zd�Zd�Zy)�
BottomMatcherzgThe main matcher class. After instantiating the patterns should
    be added using the add_fixer methodc��t�|_t�|_|jg|_g|_t
jd�|_y)N�RefactoringTool)	�set�matchr�root�nodesr�logging�	getLogger�loggerrs rrzBottomMatcher.__init__s;���U��
��H��	��i�i�[��
�����'�'�(9�:��rc��|jj|�t|j�}|j	�}|j||j��}|D]}|jj|��y)z�Reduces a fixer's pattern tree to a linear path and adds it
        to the matcher(a common Aho-Corasick automaton). The fixer is
        appended on the matching states and called when they are
        reached��startN)r�appendr�pattern_tree�get_linear_subpattern�addr")r�fixer�tree�linear�match_nodes�
match_nodes      r�	add_fixerzBottomMatcher.add_fixer%sh��
	
�����5�!��5�-�-�.���+�+�-���h�h�v�T�Y�Y�h�7��%�J����$�$�U�+�&rc	��|s|gSt|dt�rLg}|dD]@}|j||��}|D]&}|j|j|dd|���(�B|S|d|jvrt�}||j|d<n|j|d}|ddr|j|dd|��}|S|g}|S)z5Recursively adds a linear pattern to the AC automatonrr(rN)�
isinstance�tupler-�extendrr)r�patternr)r1�alternative�	end_nodes�end�	next_nodes        rr-zBottomMatcher.add1s�����7�N��g�a�j�%�(��K�&�q�z��!�H�H�[��H�>�	�$�C��&�&�t�x�x�����S�'A�B�%�	 *����q�z��!7�!7�7�"�H�	�5>��&�&�w�q�z�2�"�2�2�7�1�:�>�	��q�r�{� �H�H�W�Q�R�[�	�H�B�	���'�K�	��rc���|j}tt�}|D�]?}|}|s�	d|_|jD]5}t|tj�s�|jdk(s�.d|_n|jdk(r
|j}n|j}||jvr5|j|}|jD]}||j|��nq|j}|j�|jjr��||jvr4|j|}|jD]}||j|��|j}|r��7��B|S)auThe main interface with the bottom matcher. The tree is
        traversed from the bottom using the constructed
        automaton. Nodes are only checked once as the tree is
        retraversed. When the automaton fails, we give it one more
        shot(in case the above tree matches as a whole with the
        rejected leaf), then we break for the next leaf. There is the
        special case of multiple arguments(see code comments) where we
        recheck the nodes

        Args:
           The leaves of the AST tree to be matched

        Returns:
           A dictionary of node matches with fixers as the keys
        T�;Fr)r"r�list�was_checked�childrenr5r�Leaf�value�typerrr*�parent)	r�leaves�current_ac_node�results�leaf�current_ast_node�child�
node_tokenr.s	         r�runzBottomMatcher.runSsW�� �)�)���d�#���D�#��"�/3� �,�-�6�6�E�!�%����5�%�+�+��:L�7<�(�4��	7�
$�(�(�A�-�!1�!7�!7�J�!1�!6�!6�J���!A�!A�A�&5�&F�&F�z�&R�O�!0�!7�!7�����-�-�.>�?�"8�'+�i�i�O�(�/�/�;�,�3�3�?�?��"�_�%E�%E�E�*9�*J�*J�:�*V��%4�%;�%;�E�#�E�N�1�1�2B�C�&<�$4�#:�#:� �C#��H�rc�`��td��fd���|j�td�y)z<Prints a graphviz diagram of the BM automaton(for debugging)z
digraph g{c
�*��|jj�D]u}|j|}td|j|jt	|�t|j�fz�|dk(rt|j��|��wy)Nz%d -> %d [label=%s] //%sr)r�keys�printr�	type_repr�strrr)�node�subnode_key�subnode�
print_nodes   �rrWz*BottomMatcher.print_ac.<locals>.print_node�s|���#�4�4�9�9�;���/�/��<���0��w�w��
�
�I�k�,B�C����DW�X�Y�Z��!�#��'�/�/�*��7�#�
 <r�}N)rQr")rrWs @r�print_aczBottomMatcher.print_ac�s%���
�l��	$�	�4�9�9��
�c�
rN)	rrrrrr3r-rMrYrrrrrs"��+�;�
,� �D6�prrc���tsDddlm}|jj	�D]!\}}t|�tk(s�|t|<�#tj||�S)Nr)�python_symbols)�_type_reprs�pygramr[�__dict__�itemsrD�int�
setdefault)�type_numr[�name�vals    rrRrR�sO���*�(�0�0�6�6�8�I�D�#��C�y�C��D��S�!1�9��!�!�(�H�5�5r)r�
__author__r$r�collectionsrr
r�	btm_utilsr�objectrrr\rRrrr�<module>risH��G�;�
���#��"��V��}�F�}�@��6r

Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
26 May 2026 8.05 AM
root / root
0755
__init__.cpython-312.opt-1.pyc
0.338 KB
27 Apr 2026 4.36 PM
root / root
0644
__init__.cpython-312.opt-2.pyc
0.338 KB
27 Apr 2026 4.36 PM
root / root
0644
__init__.cpython-312.pyc
0.338 KB
27 Apr 2026 4.36 PM
root / root
0644
__main__.cpython-312.opt-1.pyc
0.271 KB
27 Apr 2026 4.36 PM
root / root
0644
__main__.cpython-312.opt-2.pyc
0.271 KB
27 Apr 2026 4.36 PM
root / root
0644
__main__.cpython-312.pyc
0.271 KB
27 Apr 2026 4.36 PM
root / root
0644
btm_matcher.cpython-312.opt-1.pyc
7.148 KB
27 Apr 2026 4.36 PM
root / root
0644
btm_matcher.cpython-312.opt-2.pyc
5.648 KB
27 Apr 2026 4.36 PM
root / root
0644
btm_matcher.cpython-312.pyc
7.148 KB
27 Apr 2026 4.36 PM
root / root
0644
btm_utils.cpython-312.opt-1.pyc
10.826 KB
27 Apr 2026 4.36 PM
root / root
0644
btm_utils.cpython-312.opt-2.pyc
9.395 KB
27 Apr 2026 4.36 PM
root / root
0644
btm_utils.cpython-312.pyc
10.826 KB
27 Apr 2026 4.36 PM
root / root
0644
fixer_base.cpython-312.opt-1.pyc
7.687 KB
27 Apr 2026 4.36 PM
root / root
0644
fixer_base.cpython-312.opt-2.pyc
5.081 KB
27 Apr 2026 4.36 PM
root / root
0644
fixer_base.cpython-312.pyc
7.687 KB
27 Apr 2026 4.36 PM
root / root
0644
fixer_util.cpython-312.opt-1.pyc
21.281 KB
27 Apr 2026 4.36 PM
root / root
0644
fixer_util.cpython-312.opt-2.pyc
19.32 KB
27 Apr 2026 4.36 PM
root / root
0644
fixer_util.cpython-312.pyc
21.281 KB
27 Apr 2026 4.36 PM
root / root
0644
main.cpython-312.opt-1.pyc
13.68 KB
27 Apr 2026 4.36 PM
root / root
0644
main.cpython-312.opt-2.pyc
11.994 KB
27 Apr 2026 4.36 PM
root / root
0644
main.cpython-312.pyc
13.732 KB
27 Apr 2026 4.36 PM
root / root
0644
patcomp.cpython-312.opt-1.pyc
9.189 KB
27 Apr 2026 4.36 PM
root / root
0644
patcomp.cpython-312.opt-2.pyc
8.727 KB
27 Apr 2026 4.36 PM
root / root
0644
patcomp.cpython-312.pyc
9.738 KB
27 Apr 2026 4.36 PM
root / root
0644
pygram.cpython-312.opt-1.pyc
1.85 KB
27 Apr 2026 4.36 PM
root / root
0644
pygram.cpython-312.opt-2.pyc
1.66 KB
27 Apr 2026 4.36 PM
root / root
0644
pygram.cpython-312.pyc
1.85 KB
27 Apr 2026 4.36 PM
root / root
0644
pytree.cpython-312.opt-1.pyc
32.406 KB
27 Apr 2026 4.36 PM
root / root
0644
pytree.cpython-312.opt-2.pyc
24.278 KB
27 Apr 2026 4.36 PM
root / root
0644
pytree.cpython-312.pyc
33.883 KB
27 Apr 2026 4.36 PM
root / root
0644
refactor.cpython-312.opt-1.pyc
33.452 KB
27 Apr 2026 4.36 PM
root / root
0644
refactor.cpython-312.opt-2.pyc
29.648 KB
27 Apr 2026 4.36 PM
root / root
0644
refactor.cpython-312.pyc
33.519 KB
27 Apr 2026 4.36 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF Static GIF