Ë  ðÔ·åó“ãó`—dZddlZddlmZddlmZddlmZGd„de«Z Gd „d e «Z y) z2Base class for fixers (optional, but recommended).éNé)ÚPatternCompiler)Úpygram)Údoes_tree_importcóÌ—eZdZdZdZdZdZdZdZe jd«Z e «Z dZdZdZdZdZdZej*Zd„Zd„Zd „Zd „Zd „Zdd „Zd „Zdd„Zd„Zd„Z d„Z!y)ÚBaseFixaOptional base class for fixers. The subclass name must be FixFooBar where FooBar is the result of removing underscores and capitalizing the words of the fix name. For example, the class name for a fixer named 'has_key' should be FixHasKey. NrÚpostFécó@—||_||_|j«y)aInitializer. Subclass may override. Args: options: a dict containing the options passed to RefactoringTool that could be used to customize the fixer through the command line. log: a list to append warnings and other messages to. N)ÚoptionsÚlogÚcompile_pattern)Úselfr r s ú)/usr/lib/python3.12/lib2to3/fixer_base.pyÚ__init__zBaseFix.__init__/s€ðˆŒ ؈ŒØ ×ÑÕócó†—|j�5t«}|j|jd¬«\|_|_yy)z–Compiles self.PATTERN into self.pattern. Subclass may override if it doesn't want to use self.{pattern,PATTERN} in .match(). NT)Ú with_tree)ÚPATTERNrrÚpatternÚ pattern_tree)rÚPCs rrzBaseFix.compile_pattern;sE€ð �<‰<Ð #Ü Ó"ˆBØ.0×.@Ñ.@ÀÇÁØKOð/Aó/QÑ +ˆDŒL˜$Õ+ð $rcó—||_y)zOSet the filename. The main refactoring tool should call this. N)Úfilename)rrs rÚ set_filenamezBaseFix.set_filenameFs €ð !ˆ� rcóJ—d|i}|jj||«xr|S)aReturns match for a given parse tree node. Should return a true or false object (not necessarily a bool). It may return a non-empty dict of matching sub-nodes as returned by a matching pattern. Subclass may override. Únode)rÚmatch©rrÚresultss rrz BaseFix.matchMs)€ð˜4�.ˆØ�|‰|×!Ñ! $¨Ó0Ò<°WЊ>Ø"ˆDŒNØ �H‰H�O‰OÐ0°4·=±=Ñ@Ô AØ �‰�‰˜Õ rcóª—|j«}|j«}d|_d}|j|||fz«|r|j|«yy)aWarn the user that a given chunk of code is not valid Python 3, but that it cannot be converted automatically. First argument is the top-level node for the code in question. Optional second argument is why it can't be converted. ÚzLine %d: could not convert: %sN)Ú get_linenoÚcloneÚprefixr1)rrÚreasonÚlinenoÚ for_outputÚmsgs rÚcannot_convertzBaseFix.cannot_convertzsV€ð—‘Ó"ˆØ—Z‘Z“\ˆ ؈ ÔØ.ˆØ ×ј ¨ Ð3Ñ3Ô4Ù Ø × Ñ ˜VÕ $ð rcóP—|j«}|jd||fz«y)zàUsed for warning the user about possible uncertainty in the translation. First argument is the top-level node for the code in question. Optional second argument is why it can't be converted. z Line %d: %sN)r4r1)rrr7r8s rÚwarningzBaseFix.warning‰s(€ð—‘Ó"ˆØ ×ј¨&°&Ð)9Ñ9Õ:rcóŠ—|j|_|j|«tjd«|_d|_y)zîSome fixers need to maintain tree-wide state. This method is called once, at the start of tree fix-up. tree - the root node of the tree to be processed. filename - the name of the file the tree came from. rTN)r%rÚ itertoolsÚcountr(r.©rÚtreers rÚ start_treezBaseFix.start_tree“s4€ðŸ/™/ˆŒØ ×ј(Ô#Ü —‘ qÓ)ˆŒ ؈�rcó—y)zóSome fixers need to maintain tree-wide state. This method is called once, at the conclusion of tree fix-up. tree - the root node of the tree to be processed. filename - the name of the file the tree came from. N©rAs rÚ finish_treezBaseFix.finish_treeŸs€ð r)Úxxx_todo_changeme©N)"Ú__name__Ú __module__Ú __qualname__Ú__doc__rrrr rr?r@r(Úsetr%ÚorderÚexplicitÚ run_orderÚ _accept_typeÚkeep_line_orderÚ BM_compatiblerÚpython_symbolsÚsymsrrrrr#r,r1r;r=rCrFrErrrrsž„ñð€GØ€GØ€LØ€GØ€H؈i�o‰o˜aÓ €GÙ“€JØ €EØ€HØ€Ià€Lð€Oà€Mð × Ñ €Dò ò Qò!ò =ò$ó ò!ó %ò;ò ó rrcó,‡—eZdZdZdZˆfd„Zd„ZˆxZS)ÚConditionalFixz@ Base class for fixers which not execute if an import is found. Ncó4•—tt|� |Žd|_yrH)ÚsuperrWrCÚ _should_skip)rÚargsÚ __class__s €rrCzConditionalFix.start_tree¯sø€Ü Œn˜dÑ.°Ñ5Ø ˆÕrcóÖ—|j� |jS|jjd«}|d}dj|dd«}t |||«|_|jS)NÚ.éÿÿÿÿ)rZÚskip_onÚsplitÚjoinr)rrÚpkgr+s rÚ should_skipzConditionalFix.should_skip³sh€Ø × Ñ Ð (Ø×$Ñ$Ð $Ø�l‰l× Ñ  Ó%ˆØ�2‰wˆØ�h‰h�s˜3˜B�xÓ ˆÜ,¨S°$¸Ó=ˆÔØ× Ñ Ð r)rIrJrKrLr`rCrdÚ __classcell__)r\s@rrWrW©sø„ÙJð€Gô!ö!rrW) rLr?Úpatcomprr3rÚ fixer_utilrÚobjectrrWrErrÚris5ðñ9óõ%ÝÝ(ôX ˆfôX ôv!�Wõ!r