$37 GRAYBYTE WORDPRESS FILE MANAGER $34

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

/opt/alt/python37/lib64/python3.7/lib2to3/__pycache__/

HOME
Current File : /opt/alt/python37/lib64/python3.7/lib2to3/__pycache__//btm_matcher.cpython-37.pyc
B

� f��@sldZdZddlZddlZddlmZddlmZddlm	Z	Gdd	�d	e
�ZGd
d�de
�Zia
dd
�ZdS)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@s eZdZdZe��Zdd�ZdS)�BMNodez?Class for a node of the Aho-Corasick automaton used in matchingcCs"i|_g|_ttj�|_d|_dS)N�)�transition_table�fixers�nextr�count�id�content)�self�r�8/opt/alt/python37/lib64/python3.7/lib2to3/btm_matcher.py�__init__szBMNode.__init__N)�__name__�
__module__�__qualname__�__doc__�	itertoolsrrrrrrrsrc@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�
BottomMatcherzgThe main matcher class. After instantiating the patterns should
    be added using the add_fixer methodcCs0t�|_t�|_|jg|_g|_t�d�|_dS)NZRefactoringTool)	�set�matchr�rootZnodesr	�loggingZ	getLoggerZlogger)rrrrrs

zBottomMatcher.__init__cCsL|j�|�t|j�}|��}|j||jd�}x|D]}|j�|�q4WdS)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	�appendrZpattern_treeZget_linear_subpattern�addr)r�fixerZtreeZlinear�match_nodesZ
match_noderrr�	add_fixer%s

zBottomMatcher.add_fixerc	Cs�|s
|gSt|dt�rhg}xF|dD]:}|j||d�}x&|D]}|�|�|dd�|��q>Wq&W|S|d|jkr�t�}||j|d<n|j|d}|dd�r�|j|dd�|d�}n|g}|SdS)z5Recursively adds a linear pattern to the AC automatonr)rrN)�
isinstance�tupler�extendrr)r�patternrr ZalternativeZ	end_nodes�endZ	next_noderrrr1s"
"zBottomMatcher.addc	Cs|j}tt�}x�|D]�}|}x�|r�d|_x,|jD]"}t|tj�r0|jdkr0d|_Pq0W|j	dkrh|j}n|j	}||j
kr�|j
|}xj|jD]}||�|�q�WnL|j}|j
dk	r�|j
jr�P||j
kr�|j
|}x|jD]}||�|�q�W|j
}qWqW|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�;FrN)rr�listZwas_checkedZchildrenr"rZLeaf�value�typerr	r�parent)	rZleavesZcurrent_ac_nodeZresultsZleafZcurrent_ast_nodeZchildZ
node_tokenrrrr�runSs6






zBottomMatcher.runcs*td��fdd���|j�td�dS)z<Prints a graphviz diagram of the BM automaton(for debugging)z
digraph g{cs^xX|j��D]J}|j|}td|j|jt|�t|j�f�|dkrNt|j��|�qWdS)Nz%d -> %d [label=%s] //%sr)r�keys�printr�	type_repr�strr	r
)ZnodeZsubnode_keyZsubnode)�
print_noderrr1�s

z*BottomMatcher.print_ac.<locals>.print_node�}N)r.r)rr)r1r�print_ac�s
zBottomMatcher.print_acN)	rrrrrr!rr,r3rrrrrs"8rcCsHts<ddlm}x*|j��D]\}}t|�tkr|t|<qWt�||�S)Nr)�python_symbols)�_type_reprsZpygramr4�__dict__�itemsr*�int�
setdefault)Ztype_numr4�name�valrrrr/�sr/)r�
__author__rr�collectionsrrrZ	btm_utilsr�objectrrr5r/rrrr�<module>s	


Current_dir [ NOT WRITEABLE ] Document_root [ NOT WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
24 May 2024 8.34 AM
root / linksafe
0755
__init__.cpython-37.opt-1.pyc
0.137 KB
17 Apr 2024 5.36 PM
root / linksafe
0644
__init__.cpython-37.opt-2.pyc
0.137 KB
17 Apr 2024 5.35 PM
root / linksafe
0644
__init__.cpython-37.pyc
0.137 KB
17 Apr 2024 5.36 PM
root / linksafe
0644
__main__.cpython-37.opt-1.pyc
0.219 KB
17 Apr 2024 5.36 PM
root / linksafe
0644
__main__.cpython-37.opt-2.pyc
0.219 KB
17 Apr 2024 5.35 PM
root / linksafe
0644
__main__.cpython-37.pyc
0.219 KB
17 Apr 2024 5.36 PM
root / linksafe
0644
btm_matcher.cpython-37.opt-1.pyc
4.775 KB
17 Apr 2024 5.36 PM
root / linksafe
0644
btm_matcher.cpython-37.opt-2.pyc
3.241 KB
17 Apr 2024 5.35 PM
root / linksafe
0644
btm_matcher.cpython-37.pyc
4.775 KB
17 Apr 2024 5.36 PM
root / linksafe
0644
btm_utils.cpython-37.opt-1.pyc
5.996 KB
17 Apr 2024 5.36 PM
root / linksafe
0644
btm_utils.cpython-37.opt-2.pyc
4.512 KB
17 Apr 2024 5.35 PM
root / linksafe
0644
btm_utils.cpython-37.pyc
5.996 KB
17 Apr 2024 5.36 PM
root / linksafe
0644
fixer_base.cpython-37.opt-1.pyc
6.086 KB
17 Apr 2024 5.36 PM
root / linksafe
0644
fixer_base.cpython-37.opt-2.pyc
3.39 KB
17 Apr 2024 5.35 PM
root / linksafe
0644
fixer_base.cpython-37.pyc
6.086 KB
17 Apr 2024 5.36 PM
root / linksafe
0644
fixer_util.cpython-37.opt-1.pyc
11.761 KB
17 Apr 2024 5.36 PM
root / linksafe
0644
fixer_util.cpython-37.opt-2.pyc
9.644 KB
17 Apr 2024 5.35 PM
root / linksafe
0644
fixer_util.cpython-37.pyc
11.761 KB
17 Apr 2024 5.36 PM
root / linksafe
0644
main.cpython-37.opt-1.pyc
8.325 KB
17 Apr 2024 5.36 PM
root / linksafe
0644
main.cpython-37.opt-2.pyc
6.611 KB
17 Apr 2024 5.35 PM
root / linksafe
0644
main.cpython-37.pyc
8.358 KB
17 Apr 2024 5.36 PM
root / linksafe
0644
patcomp.cpython-37.opt-1.pyc
5.24 KB
17 Apr 2024 5.36 PM
root / linksafe
0644
patcomp.cpython-37.opt-2.pyc
4.742 KB
17 Apr 2024 5.35 PM
root / linksafe
0644
patcomp.cpython-37.pyc
5.477 KB
17 Apr 2024 5.36 PM
root / linksafe
0644
pygram.cpython-37.opt-1.pyc
1.167 KB
17 Apr 2024 5.36 PM
root / linksafe
0644
pygram.cpython-37.opt-2.pyc
0.967 KB
17 Apr 2024 5.35 PM
root / linksafe
0644
pygram.cpython-37.pyc
1.167 KB
17 Apr 2024 5.36 PM
root / linksafe
0644
pytree.cpython-37.opt-1.pyc
23.753 KB
17 Apr 2024 5.36 PM
root / linksafe
0644
pytree.cpython-37.opt-2.pyc
14.579 KB
17 Apr 2024 5.35 PM
root / linksafe
0644
pytree.cpython-37.pyc
24.414 KB
17 Apr 2024 5.36 PM
root / linksafe
0644
refactor.cpython-37.opt-1.pyc
19.853 KB
17 Apr 2024 5.36 PM
root / linksafe
0644
refactor.cpython-37.opt-2.pyc
15.899 KB
17 Apr 2024 5.35 PM
root / linksafe
0644
refactor.cpython-37.pyc
19.885 KB
17 Apr 2024 5.36 PM
root / linksafe
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF