/usr/lib64/python3.9/lib2to3/__pycache__
NameSizeModeActions
btm_matcher.cpython-39.opt-1.pyc48770644editdlrm
btm_matcher.cpython-39.opt-2.pyc33060644editdlrm
btm_matcher.cpython-39.pyc48770644editdlrm
btm_utils.cpython-39.opt-1.pyc61480644editdlrm
btm_utils.cpython-39.opt-2.pyc46360644editdlrm
btm_utils.cpython-39.pyc61480644editdlrm
fixer_base.cpython-39.opt-1.pyc62550644editdlrm
fixer_base.cpython-39.opt-2.pyc35040644editdlrm
fixer_base.cpython-39.pyc62550644editdlrm
fixer_util.cpython-39.opt-1.pyc121700644editdlrm
fixer_util.cpython-39.opt-2.pyc100070644editdlrm
fixer_util.cpython-39.pyc121700644editdlrm
main.cpython-39.opt-1.pyc86710644editdlrm
main.cpython-39.opt-2.pyc69180644editdlrm
main.cpython-39.pyc86890644editdlrm
patcomp.cpython-39.opt-1.pyc53890644editdlrm
patcomp.cpython-39.opt-2.pyc48810644editdlrm
patcomp.cpython-39.pyc56050644editdlrm
pygram.cpython-39.opt-1.pyc12620644editdlrm
pygram.cpython-39.opt-2.pyc10570644editdlrm
pygram.cpython-39.pyc12620644editdlrm
pytree.cpython-39.opt-1.pyc236720644editdlrm
pytree.cpython-39.opt-2.pyc149690644editdlrm
pytree.cpython-39.pyc242950644editdlrm
refactor.cpython-39.opt-1.pyc206130644editdlrm
refactor.cpython-39.opt-2.pyc165670644editdlrm
refactor.cpython-39.pyc206430644editdlrm
__init__.cpython-39.opt-1.pyc3020644editdlrm
__init__.cpython-39.opt-2.pyc3020644editdlrm
__init__.cpython-39.pyc3020644editdlrm
__main__.cpython-39.opt-1.pyc2150644editdlrm
__main__.cpython-39.opt-2.pyc2150644editdlrm
__main__.cpython-39.pyc2150644editdlrm
Edit: /usr/lib64/python3.9/lib2to3/__pycache__/btm_utils.cpython-39.pyc (6148B)
a ´iî&ã@s|dZddlmZddlmZmZddlmZmZeZ eZ ej Z eZ dZdZdZGdd „d eƒZdd d „Zd d„Zdd„Zd S)z0Utility functions used by the btm_matcher moduleé)Úpytree)ÚgrammarÚtoken)Úpattern_symbolsÚpython_symbolséÿÿÿÿéþÿÿÿéýÿÿÿc@s:eZdZdZd dd„Zdd„Zdd„Zd d „Zd d „ZdS)ÚMinNodez‰This class serves as an intermediate representation of the pattern tree during the conversion to sets of leaf-to-root subpatternsNcCs.||_||_g|_d|_d|_g|_g|_dS)NF)ÚtypeÚnameÚchildrenÚleafÚparentÚ alternativesÚgroup)Úselfr r ©rú)/usr/lib64/python3.9/lib2to3/btm_utils.pyÚ__init__szMinNode.__init__cCst|jƒdt|jƒS)Nú )Ústrr r )rrrrÚ__repr__szMinNode.__repr__cCsæ|}g}|râ|jtkr^|j |¡t|jƒt|jƒkrRt|jƒg}g|_|j}qn |j}d}qâ|jtkr®|j  |¡t|j ƒt|jƒkr¢t |j ƒ}g|_ |j}qn |j}d}qâ|jt j krÎ|j rÎ| |j ¡n | |j¡|j}q|S)z°Internal method. Returns a characteristic path of the pattern tree. This method must be run for all leaves until the linear subpatterns are merged into a singleN)r ÚTYPE_ALTERNATIVESrÚappendÚlenr ÚtuplerÚ TYPE_GROUPrÚget_characteristic_subpatternÚ token_labelsÚNAMEr )rÚnodeÚsubprrrÚ leaf_to_root!s8       zMinNode.leaf_to_rootcCs&| ¡D]}| ¡}|r|SqdS)a‹Drives the leaf_to_root method. The reason that leaf_to_root must be run multiple times is because we need to reject 'group' matches; for example the alternative form (a | b c) creates a group [b c] that needs to be matched. Since matching multiple linear patterns overcomes the automaton's capabilities, leaf_to_root merges each group into a single choice based on 'characteristic'ity, i.e. (a|b c) -> (a|b) if b more characteristic than c Returns: The most 'characteristic'(as defined by get_characteristic_subpattern) path for the compiled pattern tree. N)Úleavesr#)rÚlr"rrrÚget_linear_subpatternKs zMinNode.get_linear_subpatternccs*|jD]}| ¡EdHq|js&|VdS)z-Generator that returns the leaves of the treeN)r r$)rÚchildrrrr$`s zMinNode.leaves)NN) Ú__name__Ú __module__Ú __qualname__Ú__doc__rrr#r&r$rrrrr s  *r Nc Cs¢d}|jtjkr|jd}|jtjkr�t|jƒdkrFt|jd|ƒ}nFttd�}|jD]4}|j  |¡drlqVt||ƒ}|durV|j  |¡qV�n|jtj krút|jƒdkrætt d�}|jD]}t||ƒ}|rº|j  |¡qº|jsöd}nt|jd|ƒ}�n˜|jtj k�r’t|jdtjƒ�r>|jdjdk�r>t|jd|ƒSt|jdtjƒ�rd|jdjdk�s˜t|jƒdk�rœt|jddƒ�rœ|jdjdk�rœdSd }d}d}d }d} d } |jD]d}|jtjk�rÖd }|}n*|jtjk�rîd }|} n|jtjk�r|}t|dƒ�rº|jd k�rºd } �qº| �rT|jd} t| dƒ�r^| jdk�r^|jd } n |jd} | jtjk�rº| jd k�r„ttd�}n4tt| jƒ�r¦ttt| jƒd�}nttt| jƒd�}n\| jtjk�rþ| j d¡} | tv�rîtt| d�}nttj| d�}n| jtjk�rt||ƒ}|�rL| jdjdk�r4d}n| jdjdk�rHnt‚|�r’|du�r’|jdd…D]&}t||ƒ}|du�rj|j  |¡�qj|�rž||_|S)zÏ Internal function. Reduces a compiled pattern tree to an intermediate representation suitable for feeding the automaton. This also trims off any optional pattern elements(like [a], a*). Néé)r rú(ú[ÚvalueTFú=éÚanyú')r r Ú*ú+r)r ÚsymsZMatcherr Z AlternativesrÚ reduce_treer rÚindexrZ AlternativerZUnitÚ isinstancerZLeafr0ÚhasattrZDetailsZRepeaterrr ÚTYPE_ANYÚgetattrÚpysymsÚSTRINGÚstripÚtokensÚNotImplementedErrorr) r!rZnew_noder'ZreducedrZ details_nodeZalternatives_nodeZ has_repeaterZ repeater_nodeZhas_variable_nameZ name_leafr rrrr8gs®          ÿÿ ýüû           r8csÌt|tƒs|St|ƒdkr"|dSg}g}gd¢‰g}d‰|D]d}tt|dd„ƒƒr>tt|‡fdd„ƒƒrv| |¡q>tt|‡fdd„ƒƒr˜| |¡q>| |¡q>|r®|}n|r¸|}n|rÀ|}t|td �S) z„Picks the most characteristic from a list of linear patterns Current order used is: names > common_names > common_chars rr,)ÚinÚforÚifÚnotÚNonez[]().,:cSs t|ƒtuS©N)r r©ÚxrrrÚþóz/get_characteristic_subpattern..cst|tƒo|ˆvSrH©r:rrI)Ú common_charsrrrKrLcst|tƒo|ˆvSrHrMrI)Ú common_namesrrrKrL)Úkey)r:Úlistrr3Úrec_testrÚmax)Z subpatternsZsubpatterns_with_namesZsubpatterns_with_common_namesZsubpatterns_with_common_charsÚ subpatternr)rNrOrrís6   ÿ  ÿ  rccs8|D].}t|ttfƒr(t||ƒEdHq||ƒVqdS)zPTests test_func on all items of sequence and items of included sub-iterablesN)r:rQrrR)ZsequenceZ test_funcrJrrrrRsrR)N)r+ÚrZpgen2rrZpygramrrr7r>ZopmaprArr<rrÚobjectr r8rrRrrrrÚs W %