/opt/alt/python311/lib64/python3.11/lib2to3/__pycache__
Edit: /opt/alt/python311/lib64/python3.11/lib2to3/__pycache__/btm_matcher.cpython-311.pyc (7814B)
§
üVäÀw)¦ã ó„ — d Z dZddlZddlZddlmZ ddlmZ ddlm Z G d„ d e
¦ « Z G d
„ de
¦ « Zi a
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
é N)Údefaultdicté )Úpytree)Úreduce_treec ó6 — e Zd ZdZ ej ¦ « Zd„ ZdS )ÚBMNodez?Class for a node of the Aho-Corasick automaton used in matchingc ól — i | _ g | _ t t j ¦ « | _ d| _ d S )NÚ )Útransition_tableÚfixersÚnextr ÚcountÚidÚcontent©Úselfs ú:/opt/alt/python311/lib64/python3.11/lib2to3/btm_matcher.pyÚ__init__zBMNode.__init__ s- € Ø "ˆÔ؈ŒÝ•v”|Ñ$Ô$ˆŒØˆŒˆˆó N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú itertoolsr r © r r r r s8 € € € € € ØIÐI؈IŒOÑÔ€Eðð ð ð ð r r c ó0 — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ ZdS )Ú
BottomMatcherzgThe main matcher class. After instantiating the patterns should
be added using the add_fixer methodc ó¬ — t ¦ « | _ t ¦ « | _ | j g| _ g | _ t
j d¦ « | _ d S )NÚRefactoringTool) ÚsetÚmatchr ÚrootÚnodesr ÚloggingÚ getLoggerÚloggerr s r r zBottomMatcher.__init__ sA € Ý‘U”UˆŒ
Ý‘H”HˆŒ Ø”i�[ˆŒ
؈ŒÝÔ'Ð(9Ñ:Ô:ˆŒˆˆr c ó — | j |¦ « t |j ¦ « }| ¦ « }| || j ¬¦ « }|D ]}|j |¦ « Œ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 Úpattern_treeÚget_linear_subpatternÚaddr" )r ÚfixerÚtreeÚlinearÚmatch_nodesÚ
match_nodes r Ú add_fixerzBottomMatcher.add_fixer% s… € ð
Œ×Ò˜5Ñ!Ô!Ð!ݘ5Ô-Ñ.Ô.ˆØ×+Ò+Ñ-Ô-ˆØ—h’h˜v¨T¬Y�hÑ7Ô7ˆØ%ð ,ð ,ˆJØÔ×$Ò$ UÑ+Ô+Ð+Ð+ð ,ð ,r c óÚ — |s|gS t |d t ¦ « r\g }|d D ]O}| ||¬¦ « }|D ]3}| | |dd… |¦ « ¦ « Œ4ŒP|S |d |j vrt ¦ « }||j |d <