Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
3
\± ã @ sl d Z dZddlZddlZddlmZ ddlmZ ddlm Z G dd „ d e
ƒZG d
d„ de
ƒZi a
dd
„ 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 é N)Údefaultdicté )Úpytree)Úreduce_treec @ s e Zd ZdZejƒ Zdd„ ZdS )ÚBMNodez?Class for a node of the Aho-Corasick automaton used in matchingc C s" i | _ g | _ttjƒ| _d| _d S )NÚ )Útransition_tableÚfixersÚnextr ÚcountÚidÚcontent)Úself© r ú+/usr/lib64/python3.6/lib2to3/btm_matcher.pyÚ__init__ s zBMNode.__init__N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú itertoolsr r r r r r r s r c @ s8 e Zd ZdZdd„ Zdd„ Zdd„ Zdd „ Zd
d„ ZdS )
Ú
BottomMatcherzgThe main matcher class. After instantiating the patterns should
be added using the add_fixer methodc C s0 t ƒ | _tƒ | _| jg| _g | _tjdƒ| _d S )NZRefactoringTool) ÚsetÚmatchr ÚrootZnodesr ÚloggingZ getLoggerZlogger)r r r r r s
zBottomMatcher.__init__c C sL | j j|ƒ t|jƒ}|jƒ }| j|| jd�}x|D ]}|j j|ƒ q4W dS )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 Zpattern_treeZget_linear_subpatternÚaddr )r ÚfixerZtreeZlinearÚmatch_nodesZ
match_noder r r Ú add_fixer% s
zBottomMatcher.add_fixerc C sÌ |s
|gS t |d tƒrhg }xF|d D ]:}| j||d�}x&|D ]}|j| j|dd… |ƒƒ q>W q&W