Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
ï»¿Ë â{|jßãóv—dZdZddlZddlZddlmZddlmZddlm Z Gd„d e «Z Gd „d e «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 é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-Úextendr r)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Útyper r 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 %d [label=%s] //%sr)r ÚkeysÚprintrÚ type_reprÚstrr r)ÚnodeÚ subnode_keyÚsubnodeÚ print_nodes €rrWz*BottomMatcher.print_ac..print_nodeŽs|ø€Ø#×4Ñ4×9Ñ9Ö;� Ø×/Ñ/° Ñ<�ÜÐ0Ø—w‘w § ¡ ¬I°kÓ,BÄCÈÏÉÓDWÐXñYôZà !Ò#ܘ'Ÿ/™/Ô*Ù˜7Õ#ñ risHðñGð;€ ãÛÝ#åÝ"ôˆVôô}�Fô}ð@€ ó6r