$22 GRAYBYTE WORDPRESS FILE MANAGER $97

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

/opt/alt/python27/lib64/python2.7/lib2to3/

HOME
Current File : /opt/alt/python27/lib64/python2.7/lib2to3//btm_matcher.pyc
�
�V~gc@s�dZdZddlZddlZddlmZddlmZddlm	Z	de
fd	��YZd
e
fd��YZia
d�ZdS(
s�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.s+George Boutsioukis <[email protected]>i����N(tdefaultdicti(tpytree(treduce_treetBMNodecBs#eZdZej�Zd�ZRS(s?Class for a node of the Aho-Corasick automaton used in matchingcCs1i|_g|_ttj�|_d|_dS(Nt(ttransition_tabletfixerstnextRtcounttidtcontent(tself((s8/opt/alt/python27/lib64/python2.7/lib2to3/btm_matcher.pyt__init__s		(t__name__t
__module__t__doc__t	itertoolsRR(((s8/opt/alt/python27/lib64/python2.7/lib2to3/btm_matcher.pyRst
BottomMatchercBs;eZdZd�Zd�Zd�Zd�Zd�ZRS(sgThe main matcher class. After instantiating the patterns should
    be added using the add_fixer methodcCsFt�|_t�|_|jg|_g|_tjd�|_dS(NtRefactoringTool(	tsettmatchRtroottnodesRtloggingt	getLoggertlogger(R((s8/opt/alt/python27/lib64/python2.7/lib2to3/btm_matcher.pyRs
	cCsh|jj|�t|j�}|j�}|j|d|j�}x|D]}|jj|�qJWdS(s�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
        reachedtstartN(RtappendRtpattern_treetget_linear_subpatterntaddR(Rtfixerttreetlineartmatch_nodest
match_node((s8/opt/alt/python27/lib64/python2.7/lib2to3/btm_matcher.pyt	add_fixer%s
cCs�|s
|gSt|dt�r�g}xU|dD]I}|j|d|�}x+|D]#}|j|j|d|��qSWq1W|S|d|jkr�t�}||j|d<n|j|d}|dr�|j|dd|�}n	|g}|SdS(s5Recursively adds a linear pattern to the AC automatoniRiN(t
isinstancettupleRtextendRR(RtpatternRR"talternativet	end_nodestendt	next_node((s8/opt/alt/python27/lib64/python2.7/lib2to3/btm_matcher.pyR1s"
%	
	c	Cs�|j}tt�}x�|D]y}|}xj|r�t|_x?|jD]4}t|tj�rD|j	dkrDt
|_PqDqDW|jdkr�|j	}n	|j}||jkr�|j|}x�|j
D]0}||kr�g||<n||j|�q�Wn�|j}|jdk	r%|jjr%Pn||jkr�|j|}xD|j
D]6}||j�krpg||<n||j|�qKWn|j}q+WqW|S(suThe 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
        u;iN(RRtlisttTruetwas_checkedtchildrenR%RtLeaftvaluetFalsettypeRRRtparenttNonetkeys(	Rtleavestcurrent_ac_nodetresultstleaftcurrent_ast_nodetchildt
node_tokenR((s8/opt/alt/python27/lib64/python2.7/lib2to3/btm_matcher.pytrunSs>	
		!		

	

cs*dGH�fd���|j�dGHdS(s<Prints a graphviz diagram of the BM automaton(for debugging)s
digraph g{csvxo|jj�D]^}|j|}d|j|jt|�t|j�fGH|dkrd|jGHn�|�qWdS(Ns%d -> %d [label=%s] //%si(RR7R	t	type_reprtstrRR
(tnodetsubnode_keytsubnode(t
print_node(s8/opt/alt/python27/lib64/python2.7/lib2to3/btm_matcher.pyRE�s
't}N(R(R((REs8/opt/alt/python27/lib64/python2.7/lib2to3/btm_matcher.pytprint_ac�s
(R
RRRR$RR?RG(((s8/opt/alt/python27/lib64/python2.7/lib2to3/btm_matcher.pyRs			"	=cCshtsXddlm}x?|jj�D]+\}}t|�tkr&|t|<q&q&Wntj||�S(Ni(tpython_symbols(t_type_reprstpygramRHt__dict__titemsR4tintt
setdefault(ttype_numRHtnametval((s8/opt/alt/python27/lib64/python2.7/lib2to3/btm_matcher.pyR@�s(Rt
__author__RRtcollectionsRRRt	btm_utilsRtobjectRRRIR@(((s8/opt/alt/python27/lib64/python2.7/lib2to3/btm_matcher.pyt<module>s	�


Current_dir [ NOT WRITEABLE ] Document_root [ NOT WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
24 Jan 2025 9.37 AM
root / linksafe
0755
fixes
--
24 Jan 2025 9.35 AM
root / linksafe
0755
pgen2
--
24 Jan 2025 9.35 AM
root / linksafe
0755
Grammar.txt
6.928 KB
8 Jan 2025 10.43 AM
root / linksafe
0644
Grammar2.7.18.final.0.pickle
39.537 KB
8 Jan 2025 10.43 AM
root / linksafe
0644
PatternGrammar.txt
0.774 KB
8 Jan 2025 10.43 AM
root / linksafe
0644
PatternGrammar2.7.18.final.0.pickle
2.733 KB
8 Jan 2025 10.43 AM
root / linksafe
0644
__init__.py
0.007 KB
8 Jan 2025 10.43 AM
root / linksafe
0644
__init__.pyc
0.137 KB
8 Jan 2025 10.43 AM
root / linksafe
0644
__init__.pyo
0.137 KB
8 Jan 2025 10.43 AM
root / linksafe
0644
__main__.py
0.065 KB
8 Jan 2025 10.43 AM
root / linksafe
0644
__main__.pyc
0.249 KB
8 Jan 2025 10.43 AM
root / linksafe
0644
__main__.pyo
0.249 KB
8 Jan 2025 10.43 AM
root / linksafe
0644
btm_matcher.py
6.674 KB
8 Jan 2025 10.43 AM
root / linksafe
0644
btm_matcher.pyc
5.833 KB
8 Jan 2025 10.43 AM
root / linksafe
0644
btm_matcher.pyo
5.833 KB
8 Jan 2025 10.43 AM
root / linksafe
0644
btm_utils.py
9.777 KB
8 Jan 2025 10.43 AM
root / linksafe
0644
btm_utils.pyc
7.551 KB
8 Jan 2025 10.43 AM
root / linksafe
0644
btm_utils.pyo
7.551 KB
8 Jan 2025 10.43 AM
root / linksafe
0644
fixer_base.py
6.621 KB
8 Jan 2025 10.43 AM
root / linksafe
0644
fixer_base.pyc
7.221 KB
8 Jan 2025 10.43 AM
root / linksafe
0644
fixer_base.pyo
7.221 KB
8 Jan 2025 10.43 AM
root / linksafe
0644
fixer_util.py
14.255 KB
8 Jan 2025 10.43 AM
root / linksafe
0644
fixer_util.pyc
14.771 KB
8 Jan 2025 10.43 AM
root / linksafe
0644
fixer_util.pyo
14.771 KB
8 Jan 2025 10.43 AM
root / linksafe
0644
main.py
11.333 KB
8 Jan 2025 10.43 AM
root / linksafe
0644
main.pyc
9.728 KB
8 Jan 2025 10.43 AM
root / linksafe
0644
main.pyo
9.687 KB
8 Jan 2025 10.43 AM
root / linksafe
0644
patcomp.py
6.899 KB
8 Jan 2025 10.43 AM
root / linksafe
0644
patcomp.pyc
6.599 KB
8 Jan 2025 10.43 AM
root / linksafe
0644
patcomp.pyo
6.294 KB
8 Jan 2025 10.43 AM
root / linksafe
0644
pygram.py
1.131 KB
8 Jan 2025 10.43 AM
root / linksafe
0644
pygram.pyc
1.445 KB
8 Jan 2025 10.43 AM
root / linksafe
0644
pygram.pyo
1.445 KB
8 Jan 2025 10.43 AM
root / linksafe
0644
pytree.py
28.358 KB
8 Jan 2025 10.43 AM
root / linksafe
0644
pytree.pyc
30.558 KB
8 Jan 2025 10.43 AM
root / linksafe
0644
pytree.pyo
29.695 KB
8 Jan 2025 10.43 AM
root / linksafe
0644
refactor.py
27.369 KB
8 Jan 2025 10.43 AM
root / linksafe
0644
refactor.pyc
23.872 KB
8 Jan 2025 10.43 AM
root / linksafe
0644
refactor.pyo
23.831 KB
8 Jan 2025 10.43 AM
root / linksafe
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF