/opt/alt/python311/lib64/python3.11/lib2to3/__pycache__
NameSizeModeActions
btm_matcher.cpython-311.opt-1.pyc78140644editdlrm
btm_matcher.cpython-311.opt-2.pyc62640644editdlrm
btm_matcher.cpython-311.pyc78140644editdlrm
btm_utils.cpython-311.opt-1.pyc115300644editdlrm
btm_utils.cpython-311.opt-2.pyc100560644editdlrm
btm_utils.cpython-311.pyc115300644editdlrm
fixer_base.cpython-311.opt-1.pyc84310644editdlrm
fixer_base.cpython-311.opt-2.pyc57520644editdlrm
fixer_base.cpython-311.pyc84310644editdlrm
fixer_util.cpython-311.opt-1.pyc223810644editdlrm
fixer_util.cpython-311.opt-2.pyc203680644editdlrm
fixer_util.cpython-311.pyc223810644editdlrm
main.cpython-311.opt-1.pyc152200644editdlrm
main.cpython-311.opt-2.pyc134840644editdlrm
main.cpython-311.pyc152660644editdlrm
patcomp.cpython-311.opt-1.pyc102230644editdlrm
patcomp.cpython-311.opt-2.pyc97440644editdlrm
patcomp.cpython-311.pyc107250644editdlrm
pygram.cpython-311.opt-1.pyc20700644editdlrm
pygram.cpython-311.opt-2.pyc18730644editdlrm
pygram.cpython-311.pyc20700644editdlrm
pytree.cpython-311.opt-1.pyc352100644editdlrm
pytree.cpython-311.opt-2.pyc268610644editdlrm
pytree.cpython-311.pyc369930644editdlrm
refactor.cpython-311.opt-1.pyc384440644editdlrm
refactor.cpython-311.opt-2.pyc345390644editdlrm
refactor.cpython-311.pyc385260644editdlrm
__init__.cpython-311.opt-1.pyc3870644editdlrm
__init__.cpython-311.opt-2.pyc3870644editdlrm
__init__.cpython-311.pyc3870644editdlrm
__main__.cpython-311.opt-1.pyc3310644editdlrm
__main__.cpython-311.opt-2.pyc3310644editdlrm
__main__.cpython-311.pyc3310644editdlrm
Edit: /opt/alt/python311/lib64/python3.11/lib2to3/__pycache__/btm_matcher.cpython-311.pyc (7814B)
§ üVäÀw)¦ãó„—dZdZddlZddlZddlmZddlmZddlm Z Gd„d e ¦«Z Gd „d e ¦«Z ia 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—eZdZdZej¦«Zd„ZdS)ÚBMNodez?Class for a node of the Aho-Corasick automaton used in matchingcól—i|_g|_ttj¦«|_d|_dS)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__Ú itertoolsrr©rrrrs8€€€€€ØIÐIØ ˆIŒOÑ Ô €Eðððððrrcó0—eZdZdZd„Zd„Zd„Zd„Zd„ZdS)Ú BottomMatcherzgThe main matcher class. After instantiating the patterns should be added using the add_fixer methodcó¬—t¦«|_t¦«|_|jg|_g|_t jd¦«|_dS)NÚRefactoringTool) ÚsetÚmatchrÚrootÚnodesr ÚloggingÚ getLoggerÚloggerrs rrzBottomMatcher.__init__sA€Ý‘U”UˆŒ Ý‘H”HˆŒ Ø”i�[ˆŒ ؈Œ ÝÔ'Ð(9Ñ:Ô:ˆŒ ˆ ˆ rcó—|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Ñ +Ô +Ð +Ð +ð ,ð ,rc óÚ—|s|gSt|dt¦«r\g}|dD]O}| ||¬¦«}|D]3}| | |dd…|¦«¦«Œ4ŒP|S|d|jvrt ¦«}||j|d<n|j|d}|dd…r | |dd…|¬¦«}n|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ð Cð C� ð!ŸHšH [¸˜HÑ>Ô>� Ø$ðCðC�CØ×&Ò& t§x¢x°¸¸¸´ ¸SÑ'AÔ'AÑBÔBÐBÐBðCàÐ ð�qŒz Ô!7Ð7Ð7å"™HœH� Ø5>�Ô& w¨q¤zÑ2Ð2ð"Ô2°7¸1´:Ô>� à�q�r�rŒ{ð (Ø ŸHšH W¨Q¨R¨R¤[¸ ˜HÑBÔB� � à&˜K� ØÐ rcó6—|j}tt¦«}|D]ú}|}|rôd|_|jD]0}t |t j¦«r|jdkr d|_nŒ1|j dkr|j}n|j }||j vr3|j |}|j D]}||  |¦«ŒnV|j}|j � |j jrnD||j vr2|j |}|j D]}||  |¦«Œ|j }|°ôŒû|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.runSs€ð œ)ˆÝ�dÑ#Ô#ˆØð# ;ð# ;ˆDØ#Ð Ø"ð! ;Ø/3Ð Ô,Ø-Ô6ðð�Eå! %­¬Ñ5Ô5ð¸%¼+ÈÒ:LÐ:LØ7<Ð(Ô4ؘøØ#Ô(¨AÒ-Ð-à!1Ô!7�J�Jà!1Ô!6�Jà Ô!AÐAÐAà&5Ô&FÀzÔ&R�OØ!0Ô!7ð@ð@˜Ø œ×-Ò-Ð.>Ñ?Ô?Ð?Ð?ð@ð'+¤i�OØ(Ô/Ð;Ø,Ô3Ô?ð<ðð" _Ô%EÐEÐEà*9Ô*JÈ:Ô*V˜Ø%4Ô%;ðDðD˜EØ# EœN×1Ò1Ð2BÑCÔCÐCÐCà#3Ô#:Ð ðC#ð! ;øðDˆrcón‡—td¦«ˆfd„Љ|j¦«td¦«dS)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×9Ò9Ñ;Ô;ð $ð $� ØÔ/° Ô<�ÝÐ0Ø”w ¤ ­I°kÑ,BÔ,BÅCÈÌÑDWÔDWÐXñYñZôZðZà !Ò#Ð#ݘ'œ/Ñ*Ô*Ð*Ø� ˜7Ñ#Ô#Ð#Ð#ð  $ð $rú}N)rQr")rrWs @rÚprint_aczBottomMatcher.print_ac‹sMø€å ˆlÑÔÐð $ð $ð $ð $ð $ð ˆ �4”9ÑÔÐÝ ˆc‰ Œ ˆ ˆ ˆ rN) rrrrrr3r-rMrYrrrrrsk€€€€€ð+ð+ð;ð;ð;ð ,ð ,ð ,ð ð ð ðD6ð6ð6ðp ð ð ð ð rrcóÔ—tsGddlm}|j ¦«D]'\}}t |¦«t kr |t|<Œ(t ||¦«S)Nr)Úpython_symbols)Ú _type_reprsÚpygramr[Ú__dict__ÚitemsrDÚintÚ setdefault)Útype_numr[ÚnameÚvals rrRrR›sq€å ð9Ø*Ð*Ð*Ð*Ð*Ð*ð(Ô0×6Ò6Ñ8Ô8ð 9ð 9‰IˆD�#Ý�C‰yŒy�CÒаD¥¨SÑ!1øÝ × !Ò ! (¨HÑ 5Ô 5Ð5r)rÚ __author__r$rÚ collectionsrr rÚ btm_utilsrÚobjectrrr\rRrrrúrisàððGðGð;€ à€€€ØÐÐÐØ#Ð#Ð#Ð#Ð#Ð#àÐÐÐÐÐØ"Ð"Ð"Ð"Ð"Ð"ðððððˆVñôðð}ð}ð}ð}ð}�Fñ}ô}ð}ð@€ ð6ð6ð6ð6ð6r