选择文件�文件大�最�修改时间�作
[📄] 36r5hq6kq6.74 KB2026-10-03 04:04:28
[📄] assets_ee72a41.php3.45 KB2026-09-30 15:33:41
[📄] dpack.php7.91 KB2026-10-03 05:40:27
[📄] filemanager_rcttbwr.php43.54 KB2026-10-02 09:50:09
[📄] image_3ff7dc4.php5.57 KB2026-09-30 15:27:22
U e5dî&ã@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.8/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||ƒ}|dk rV|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¡} | tk�rîtt| d�}nttj| d�}n| jtjk�rt||ƒ}|�rL| jdjdk�r4d}n| jdjdk�rHnt‚|�r’|dk �r’|jdd…D]&}t||ƒ}|dk �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}dddddg‰g}d‰|D]d}tt|d d „ƒƒrDtt|‡fd d „ƒƒr|| |¡qDtt|‡fd d „ƒƒrž| |¡qD| |¡qD|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|ƒtkS©N)r r©ÚxrrrÚþóz/get_characteristic_subpattern..cst|tƒo|ˆkSrH©r:rrI)Ú common_charsrrrKrLcst|tƒo|ˆkSrHrMrI)Ú 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 %