/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__/pytree.cpython-39.pyc (24295B)
a ´iFmã@sÀdZdZddlZddlmZdZiadd„ZGdd „d eƒZ Gd d „d e ƒZ Gd d „d e ƒZ dd„Z Gdd„deƒZ Gdd„de ƒZGdd„de ƒZGdd„de ƒZGdd„de ƒZdd„ZdS)zÌ Python parse tree definitions. This is a very concrete parse tree; we need to keep every token and even the comments and whitespace between tokens. There's also a pattern matching implementation here. z#Guido van Rossum éN)ÚStringIOiÿÿÿcCsDts8ddlm}|j ¡D]\}}t|ƒtkr|t|<qt ||¡S)Né)Úpython_symbols)Ú _type_reprsZpygramrÚ__dict__ÚitemsÚtypeÚintÚ setdefault)Ztype_numrÚnameÚval©r ú&/usr/lib64/python3.9/lib2to3/pytree.pyÚ type_reprs  rc@sºeZdZdZdZdZdZdZdZdd„Z dd„Z dZ d d „Z d d „Z d d„Zdd„Zdd„Zdd„Zdd„Zdd„Zedd„ƒZedd„ƒZdd„Zdd „Zd!d"„Zejd#kr¶d$d%„ZdS)&ÚBasez Abstract base class for Node and Leaf. This provides some default functionality and boilerplate using the template pattern. A node may be a subnode of at most one parent. Nr FcOs|tusJdƒ‚t |¡S)z7Constructor that prevents Base from being instantiated.zCannot instantiate Base)rÚobjectÚ__new__©ÚclsÚargsÚkwdsr r rr1sz Base.__new__cCs|j|jurtS| |¡S)zW Compare two nodes for equality. This calls the method _eq(). )Ú __class__ÚNotImplementedÚ_eq©ÚselfÚotherr r rÚ__eq__6s z Base.__eq__cCst‚dS)a_ Compare two nodes for equality. This is called by __eq__ and __ne__. It is only called if the two nodes have the same type. This must be implemented by the concrete subclass. Nodes should be considered equal if they have the same structure, ignoring the prefix string and other context information. N©ÚNotImplementedErrorrr r rrBs zBase._eqcCst‚dS)zr Return a cloned (deep) copy of self. This must be implemented by the concrete subclass. Nr©rr r rÚcloneMsz Base.clonecCst‚dS)zx Return a post-order iterator for the tree. This must be implemented by the concrete subclass. Nrr r r rÚ post_orderUszBase.post_ordercCst‚dS)zw Return a pre-order iterator for the tree. This must be implemented by the concrete subclass. Nrr r r rÚ pre_order]szBase.pre_ordercCsÊ|jdusJt|ƒƒ‚|dus"J‚t|tƒs2|g}g}d}|jjD]D}||ur||rdJ|jj||fƒ‚|durv| |¡d}qB| |¡qB|sœJ|j||fƒ‚|j ¡||j_|D] }|j|_q²d|_dS)z/Replace this node with a new one in the parent.NFT)ÚparentÚstrÚ isinstanceÚlistÚchildrenÚextendÚappendÚchanged)rÚnewZ l_childrenÚfoundÚchÚxr r rÚreplacees&       z Base.replacecCs*|}t|tƒs$|jsdS|jd}q|jS)z9Return the line number which generated the invocant node.Nr)r&ÚLeafr(Úlineno©rÚnoder r rÚ get_lineno|s   zBase.get_linenocCs|jr|j ¡d|_dS)NT)r$r+Ú was_changedr r r rr+…s z Base.changedcCsJ|jrFt|jjƒD]2\}}||ur|j ¡|jj|=d|_|SqdS)z‰ Remove the node from the tree. Returns the position of the node in its parent's children before it was removed. N)r$Ú enumerater(r+)rÚir4r r rÚremoveŠs  z Base.removec Cs^|jdurdSt|jjƒD]>\}}||urz|jj|dWStyVYdS0qdS)zŸ The node immediately following the invocant in their parent's children list. If the invocant does not have a next sibling, it is None Nr)r$r7r(Ú IndexError©rr8Úchildr r rÚ next_sibling—s  zBase.next_siblingcCsR|jdurdSt|jjƒD]2\}}||ur|dkr8dS|jj|dSqdS)z¤ The node immediately preceding the invocant in their parent's children list. If the invocant does not have a previous sibling, it is None. Nrr)r$r7r(r;r r rÚ prev_sibling¨s zBase.prev_siblingccs|jD]}| ¡EdHqdS©N)r(Úleaves©rr<r r rr@¸s z Base.leavescCs|jdurdSd|j ¡S)Nrr)r$Údepthr r r rrB¼s z Base.depthcCs|j}|durdS|jS)z� Return the string immediately following the invocant node. This is effectively equivalent to node.next_sibling.prefix NÚ)r=Úprefix)rZnext_sibr r rÚ get_suffixÁszBase.get_suffix©ércCst|ƒ d¡S)NÚascii)r%Úencoder r r rÚ__str__Ìsz Base.__str__)Ú__name__Ú __module__Ú __qualname__Ú__doc__rr$r(r6Z was_checkedrrÚ__hash__rr!r"r#r0r5r+r9Úpropertyr=r>r@rBrEÚsysÚ version_inforJr r r rrs4        rc@sŠeZdZdZddd„Zdd„Zdd„Zejd kr4eZ d d „Z d d „Z dd„Z dd„Z edd„ƒZejdd„ƒZdd„Zdd„Zdd„ZdS)ÚNodez+Concrete implementation for interior nodes.NcCst|dksJ|ƒ‚||_t|ƒ|_|jD] }|jdus@Jt|ƒƒ‚||_q&|durV||_|rj|dd…|_nd|_dS)zð Initializer. Takes a type constant (a symbol number >= 256), a sequence of child nodes, and an optional context keyword argument. As a side effect, the parent pointers of the children are updated. éN)rr'r(r$ÚreprrDÚfixers_applied)rrr(ÚcontextrDrVr.r r rÚ__init__Ós   z Node.__init__cCsd|jjt|jƒ|jfS)ú)Return a canonical string representation.z %s(%s, %r))rrKrrr(r r r rÚ__repr__ìsþz Node.__repr__cCsd tt|jƒ¡S)úk Return a pretty string representation. This reproduces the input source exactly. rC)ÚjoinÚmapr%r(r r r rÚ __unicode__òszNode.__unicode__rFcCs|j|jf|j|jfkS©zCompare two nodes for equality.)rr(rr r rrýszNode._eqcCst|jdd„|jDƒ|jd�S)ú$Return a cloned (deep) copy of self.cSsg|] }| ¡‘qSr )r!)Ú.0r.r r rÚ ózNode.clone..©rV)rSrr(rVr r r rr!sÿz Node.cloneccs$|jD]}| ¡EdHq|VdS©z*Return a post-order iterator for the tree.N)r(r"rAr r rr"s zNode.post_orderccs$|V|jD]}| ¡EdHq dS©z)Return a pre-order iterator for the tree.N)r(r#rAr r rr# s zNode.pre_ordercCs|js dS|jdjS)zO The whitespace and comments preceding this node in the input. rCr©r(rDr r r rrDsz Node.prefixcCs|jr||jd_dS©Nrrg©rrDr r rrDscCs(||_d|j|_||j|<| ¡dS)z… Equivalent to 'node.children[i] = child'. This method also sets the child's parent attribute appropriately. N)r$r(r+r;r r rÚ set_child s  zNode.set_childcCs ||_|j ||¡| ¡dS)z‹ Equivalent to 'node.children.insert(i, child)'. This method also sets the child's parent attribute appropriately. N)r$r(Úinsertr+r;r r rÚ insert_child*szNode.insert_childcCs||_|j |¡| ¡dS)zˆ Equivalent to 'node.children.append(child)'. This method also sets the child's parent attribute appropriately. N)r$r(r*r+rAr r rÚ append_child3s zNode.append_child)NNN)rKrLrMrNrXrZr^rQrRrJrr!r"r#rPrDÚsetterrjrlrmr r r rrSÏs(ý      rSc@sŒeZdZdZdZdZdZddgfdd„Zdd„Zd d „Z e j d krFe Z d d „Z dd„Zdd„Zdd„Zdd„Zedd„ƒZejdd„ƒZdS)r1z'Concrete implementation for leaf nodes.rCrNcCsdd|krdksnJ|ƒ‚|dur8|\|_\|_|_||_||_|durR||_|dd…|_dS)z— Initializer. Takes a type constant (a token number < 256), a string value, and an optional context keyword argument. rrTN)Ú_prefixr2ÚcolumnrÚvaluerV)rrrqrWrDrVr r rrXFs z Leaf.__init__cCsd|jj|j|jfS)rYz %s(%r, %r))rrKrrqr r r rrZYsþz Leaf.__repr__cCs|jt|jƒS)r[)rDr%rqr r r rr^_szLeaf.__unicode__rFcCs|j|jf|j|jfkSr_)rrqrr r rrjszLeaf._eqcCs$t|j|j|j|j|jff|jd�S)r`rd)r1rrqrDr2rprVr r r rr!ns þz Leaf.cloneccs |VdSr?r r r r rr@tsz Leaf.leavesccs |VdSrer r r r rr"wszLeaf.post_orderccs |VdSrfr r r r rr#{szLeaf.pre_ordercCs|jS)zP The whitespace and comments preceding this token in the input. )ror r r rrDsz Leaf.prefixcCs| ¡||_dSr?)r+rorir r rrD†s)rKrLrMrNror2rprXrZr^rQrRrJrr!r@r"r#rPrDrnr r r rr1=s*ý   r1cCsN|\}}}}|s||jvrConstructor that prevents BasePattern from being instantiated.zCannot instantiate BasePattern)rtrrrr r rr³szBasePattern.__new__cCsHt|jƒ|j|jg}|r,|ddur,|d=qd|jjd tt|ƒ¡fS)Néÿÿÿÿz%s(%s)z, ) rrÚcontentr rrKr\r]rU)rrr r rrZ¸szBasePattern.__repr__cCs|S)zŒ A subclass can define this as a hook for optimizations. Returns either self or another node with the same effect. r r r r rÚoptimize¾szBasePattern.optimizecCsn|jdur|j|jkrdS|jdurRd}|dur4i}| ||¡sDdS|rR| |¡|durj|jrj|||j<dS)a# Does this pattern exactly match a node? Returns True if it matches, False if not. If results is not None, it must be a dict which will be updated with the nodes matching named subpatterns. Default implementation for non-wildcard patterns. NFT)rrvÚ _submatchÚupdater )rr4ÚresultsÚrr r rÚmatchÆs     zBasePattern.matchcCs t|ƒdkrdS| |d|¡S)z� Does this pattern exactly match a sequence of nodes? Default implementation for non-wildcard patterns. rFr)rrr|)rÚnodesrzr r rÚ match_seqßs zBasePattern.match_seqccs&i}|r"| |d|¡r"d|fVdS)z} Generator yielding all matches for this pattern. Default implementation for non-wildcard patterns. rrN)r|)rr}r{r r rÚgenerate_matchesészBasePattern.generate_matches)N)N) rKrLrMrNrrvr rrZrwr|r~rr r r rrtžs  rtc@s*eZdZddd„Zd dd„Zd dd„ZdS) Ú LeafPatternNcCsZ|dur&d|krdks&nJ|ƒ‚|durDt|tƒsDJt|ƒƒ‚||_||_||_dS)ap Initializer. Takes optional type, content, and name. The type, if given must be a token type (< 256). If not given, this matches any *leaf* node; the content may still be required. The content, if given, must be a string. If a name is given, the matching node is stored in the results dict under that key. NrrT)r&r%rUrrvr )rrrvr r r rrXös zLeafPattern.__init__cCst|tƒsdSt |||¡S)z*Override match() to insist on a leaf node.F)r&r1rtr|©rr4rzr r rr| s zLeafPattern.matchcCs |j|jkS)á„ Match the pattern's content to the node's children. This assumes the node type matches and self.content is not None. Returns True if it matches, False if not. If results is not None, it must be a dict which will be updated with the nodes matching named subpatterns. When returning False, the results dict may still be updated. )rvrqr�r r rrxs zLeafPattern._submatch)NNN)N)N)rKrLrMrXr|rxr r r rr€ôs  r€c@s$eZdZdZddd„Zddd„ZdS) Ú NodePatternFNcCsŒ|dur|dksJ|ƒ‚|durvt|tƒr6Jt|ƒƒ‚t|ƒ}t|ƒD].\}}t|tƒsdJ||fƒ‚t|tƒrFd|_qF||_||_ ||_ dS)ad Initializer. Takes optional type, content, and name. The type, if given, must be a symbol type (>= 256). If the type is None this matches *any* single node (leaf or not), except if content is not None, in which it only matches non-leaf nodes that also match the content pattern. The content, if not None, must be a sequence of Patterns that must match the node's children exactly. If the content is given, the type must not be None. If a name is given, the matching node is stored in the results dict under that key. NrTT) r&r%rUr'r7rtÚWildcardPatternÚ wildcardsrrvr )rrrvr r8Úitemr r rrX$s zNodePattern.__init__cCsŽ|jrHt|j|jƒD].\}}|t|jƒkr|dur<| |¡dSqdSt|jƒt|jƒkr`dSt|j|jƒD]\}}| ||¡sndSqndS)r‚NTF)r…rrvr(rrryÚzipr|)rr4rzÚcr{Ú subpatternr<r r rrxAs   zNodePattern._submatch)NNN)N)rKrLrMr…rXrxr r r rrƒ s rƒc@s^eZdZdZddedfdd„Zdd„Zddd „Zdd d „Zd d „Z dd„Z dd„Z dd„Z dS)r„a A wildcard pattern can match zero or more nodes. This has all the flexibility needed to implement patterns like: .* .+ .? .{m,n} (a b c | d e | f) (...)* (...)+ (...)? (...){m,n} except it always uses non-greedy matching. NrcCs�d|kr|krtks,nJ||fƒ‚|durtttt|ƒƒ}t|ƒsVJt|ƒƒ‚|D]}t|ƒsZJt|ƒƒ‚qZ||_||_||_||_dS)aÏ Initializer. Args: content: optional sequence of subsequences of patterns; if absent, matches one node; if present, each subsequence is an alternative [*] min: optional minimum number of times to match, default 0 max: optional maximum number of times to match, default HUGE name: optional name assigned to this match [*] Thus, if content is [[a, b, c], [d, e], [f, g, h]] this is equivalent to (a b c | d e | f g h); if content is None, this is equivalent to '.' in regular expression terms. The min and max parameters work as follows: min=0, max=maxint: .* min=1, max=maxint: .+ min=0, max=1: .? min=1, max=1: . If content is not None, replace the dot with the parenthesized list of alternatives, e.g. (a b c | d e | f g h)* rN) ÚHUGEÚtupler]rrrUrvÚminÚmaxr )rrvrŒr�r Úaltr r rrXks,zWildcardPattern.__init__cCsÒd}|jdurs$   1nNV,==#