选择文件�文件大�最�修改时间�作
[📄] 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
a ´iÀÛã@sôdZddlZddlTddlmZmZddlmZmZd`ddd œd d „Z d d „Z daddœdd„Z dd„Z dd„Z dbdd„Zdd„Zdd„Zdcdd„Zdd „Zd!d"„Zdd#œd$d%„Zd&d'„ZGd(d)„d)eƒZGd*d+„d+eƒZeed,ƒ�s d-d.„Zd/d0„Zeeeƒe_eeeƒe_Gd1d2„d2e ƒZ!d3d4„Z"Gd5d6„d6ee!d7�Z#Gd8d9„d9ee!d7�Z$Gd:d;„d;ee!d7�Z%Gdd?„d?ee!d7�Z'e#e(e)e*fe$e+fe%e,fe&e dƒe-fe'e d@ƒfiZ.e#e-fiZ/e-d=e dƒd=e(d6e)d6e*d6e+d9e,d;e d@ƒd?iZ0GdAdB„dBe1ƒZ2GdCdD„dDe2ƒZ3GdEdF„dFe2ƒZ4ee5dGƒ�sFdHdI„Z6dJdK„Z7ee6e7ƒe5_8GdLdM„dMe9ƒZ:GdNdO„dOe;ƒZdTe?ej@jAdƒZBGdUdV„dVeƒZCdWZDdXZEgeD¢eE¢RZFGdYdZ„dZeƒZGd[d\„ZHd]d^„ZIeJd_k�rðeIƒdS)daH ast ~~~ The `ast` module helps Python applications to process trees of the Python abstract syntax grammar. The abstract syntax itself might change with each Python release; this module helps to find out programmatically what the current grammar looks like and allows modifications of it. An abstract syntax tree can be generated by passing `ast.PyCF_ONLY_AST` as a flag to the `compile()` builtin function or by using the `parse()` function from this module. The result will be a tree of objects whose classes all inherit from `ast.AST`. A modified abstract syntax tree can be compiled into a Python code object using the built-in `compile()` function. Additionally various helper functions are provided that make working with the trees simpler. The main intention of the helper functions and this module in general is to provide an easy to use interface for libraries that work tightly with the python syntax (template engines for example). :copyright: Copyright 2008 by Armin Ronacher. :license: Python License. éN)Ú*)ÚcontextmanagerÚ nullcontext)ÚIntEnumÚautoú ÚexecF)Ú type_commentsÚfeature_versioncCsFt}|r|tO}t|tƒr(|\}}|}n |dur4d}t|||||d�S)z½ Parse the source into an AST node. Equivalent to compile(source, filename, mode, PyCF_ONLY_AST). Pass type_comments=True to get back type comments where the syntax allows. Néÿÿÿÿ)Ú_feature_version)Z PyCF_ONLY_ASTZPyCF_TYPE_COMMENTSÚ isinstanceÚtupleÚcompile)ÚsourceÚfilenameÚmoder r ÚflagsÚmajorÚminor©rú/usr/lib64/python3.9/ast.pyÚparse!s  ÿrcs`t|tƒrt|dd�}t|tƒr&|j}dd„‰‡fdd„‰‡fdd„‰‡‡‡‡fd d „‰ˆ|ƒS) aT Evaluate an expression node or a string containing only a Python expression. The string or node provided may only consist of the following Python literal structures: strings, bytes, numbers, tuples, lists, dicts, sets, booleans, and None. Caution: A complex expression can overflow the C stack and cause a crash. Úeval©rcSstd|›�ƒ‚dS)Nzmalformed node or string: )Ú ValueError©ÚnoderrrÚ_raise_malformed_nodeCsz+literal_eval.._raise_malformed_nodecs,t|tƒrt|jƒtttfvr&ˆ|ƒ|jS©N)r ÚConstantÚtypeÚvalueÚintÚfloatÚcomplexr)rrrÚ _convert_numEsz"literal_eval.._convert_numcsDt|tƒr._convert_signed_numcsZt|tƒr|jSt|tƒr*ttˆ|jƒƒSt|tƒrDttˆ|jƒƒSt|t ƒr^t tˆ|jƒƒSt|t ƒr¢t|j t ƒr¢|j jdkr¢|j|jkr˜gkr¢nnt ƒSt|tƒræt|jƒt|jƒkrȈ|ƒtttˆ|jƒtˆ|jƒƒƒSt|tƒ�rRt|jttfƒ�rRˆ|jƒ}ˆ|jƒ}t|ttfƒ�rRt|tƒ�rRt|jtƒ�rJ||S||Sˆ|ƒS)NÚset) r r r"ÚTuplerÚmapÚeltsÚListÚlistÚSetr,ZCallÚfuncÚNameÚidÚargsÚkeywordsÚDictÚlenÚkeysÚvaluesÚdictÚzipZBinOpr'ÚAddÚSubÚleftÚrightr#r$r%)rr@rA©Ú_convertr&r+rrrrCQs<     ÿÿÿ   ÿ  zliteral_eval.._convert)r ÚstrrZ ExpressionÚbody)Znode_or_stringrrBrÚ literal_eval6s     rFT)ÚindentcsTd‡‡‡‡fdd„ ‰t|tƒs.td|jjƒ‚ˆdurHtˆtƒsHdˆ‰ˆ|ƒdS)a� Return a formatted dump of the tree in node. This is mainly useful for debugging purposes. If annotate_fields is true (by default), the returned string will show the names and the values for fields. If annotate_fields is false, the result string will be more compact by omitting unambiguous field names. Attributes such as line numbers and column offsets are not dumped by default. If this is wanted, include_attributes can be set to true. If indent is a non-negative integer or string, then the tree will be pretty-printed with that indent level. None (the default) selects the single line representation. rc süˆdur*ˆd7‰dˆˆ}dˆˆ}nd}d}t|tƒ�r´t|ƒ}g}d}ˆ}|jD]„}zt||ƒ} Wnty„d}YqXYn0| dur¤t||dƒdur¤d}qXˆ| ˆƒ\} } |o¸| }|rÒ| d|| f¡qX| | ¡qXˆ�rh|j�rh|jD]t}zt||ƒ} Wnt�yYqòYn0| du�r§óz(dump.._format..)r ÚASTr!Ú_fieldsÚgetattrÚAttributeErrorÚappendÚ _attributesr9Ú __class__Ú__name__Újoinr1Úrepr) rrQÚprefixÚsepÚclsr6Z allsimpler7Únamer"Úsimple©rPÚannotate_fieldsÚinclude_attributesrG)rQrrPzsX          &zdump.._formatzexpected AST, got %rNú )r)r rTÚ TypeErrorrZr[rD)rrdrerGrrcrÚdumpns 0 rhcCsVdD]L}||jvr||jvrt||dƒ}|dusDt||ƒr| d¡rt|||ƒq|S)z¬ Copy source location (`lineno`, `col_offset`, `end_lineno`, and `end_col_offset` attributes) from *old_node* to *new_node* if possible, and return *new_node*. )ÚlinenoÚ col_offsetÚ end_linenoÚend_col_offsetNZend_)rYrVÚhasattrÚ startswithÚsetattr)Únew_nodeZold_nodeÚattrr"rrrÚ copy_location±s ÿÿrrcs ‡fdd„‰ˆ|ddddƒ|S)a{ When you compile a node tree with compile(), the compiler expects lineno and col_offset attributes for every node that supports them. This is rather tedious to fill in for generated nodes, so this helper adds these attributes recursively where not already set, by setting them to the values of the parent node. It works recursively starting at *node*. cs¶d|jvr"t|dƒs||_n|j}d|jvrJt|ddƒdurD||_n|j}d|jvrlt|dƒsf||_n|j}d|jvr”t|ddƒdurŽ||_n|j}t|ƒD]}ˆ|||||ƒqœdS)Nrirkrjrl)rYrmrirVrkrjrlÚiter_child_nodes)rrirjrkrlÚchild©Ú_fixrrrvÊs$       z#fix_missing_locations.._fixrHrrrrrurÚfix_missing_locationsÂs rwrHcCsVt|ƒD]H}d|jvr(t|ddƒ||_d|jvrt|ddƒ}dur|||_q|S)z´ Increment the line number and end line number of each node in the tree starting at *node* by *n*. This is useful to "move code" to a different location in a file. rirrkN)ÚwalkrYrVrirk)rÚnrtrkrrrÚincrement_linenoås  ÿþ rzc cs8|jD],}z|t||ƒfVWqty0Yq0qdS)zs Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields`` that is present on *node*. N)rUrVrW)rÚfieldrrrÚ iter_fieldsös   r|ccsLt|ƒD]>\}}t|tƒr"|Vqt|tƒr|D]}t|tƒr0|Vq0qdS)z‰ Yield all direct child nodes of *node*, that is, all fields that are nodes and all items of fields that are lists of nodes. N)r|r rTr1)rrar{Úitemrrrrss   rscCs–t|ttttfƒs"td|jjƒ‚|jr8t|jdt ƒs|jdus|jdurWdS|jd}|jd}|j}|j}WntyRYdS0t|ƒ}||kr||| ¡||… ¡S|ržt|| ¡d|… ¡ƒ}nd}||| ¡|d… ¡} || ¡d|… ¡} ||d|…}|  d| ¡|  | ¡d  |¡S)aBGet source code segment of the *source* that generated *node*. If some location information (`lineno`, `end_lineno`, `col_offset`, or `end_col_offset`) is missing, return None. If *padded* is `True`, the first line of a multi-line statement will be padded with spaces to match its original position. NrHrJr) rkrlrirjrWrŒÚencodeÚdecoderŽÚinsertrXr\) rrr�rirkrjrlrŠZpaddingÚfirstÚlastrrrÚget_source_segmentNs*       r•ccs<ddlm}||gƒ}|r8| ¡}| t|ƒ¡|VqdS)zå Recursively yield all descendant nodes in the tree starting at *node* (including *node* itself), in no specified order. This is useful if you only want to modify nodes in place and don't care about the context. r)ÚdequeN)Ú collectionsr–ÚpopleftÚextendrs)rr–Ztodorrrrxss   rxc@s(eZdZdZdd„Zdd„Zdd„ZdS) Ú NodeVisitora< A node visitor base class that walks the abstract syntax tree and calls a visitor function for every node found. This function may return a value which is forwarded by the `visit` method. This class is meant to be subclassed, with the subclass adding visitor methods. Per default the visitor functions for the nodes are ``'visit_'`` + class name of the node. So a `TryFinally` node visit function would be `visit_TryFinally`. This behavior can be changed by overriding the `visit` method. If no visitor function exists for a node (return value `None`) the `generic_visit` visitor is used instead. Don't use the `NodeVisitor` if you want to apply changes to nodes during traversing. For this a special visitor exists (`NodeTransformer`) that allows modifications. cCs"d|jj}t|||jƒ}||ƒS)z Visit a node.Úvisit_)rZr[rVÚ generic_visit)ÚselfrÚmethodÚvisitorrrrÚvisit•s zNodeVisitor.visitcCsTt|ƒD]F\}}t|tƒr:|D]}t|tƒr| |¡qqt|tƒr| |¡qdS)z9Called if no explicit visitor function exists for a node.N)r|r r1rTr )r�rr{r"r}rrrrœ›s   zNodeVisitor.generic_visitc Cs |j}t t|ƒ¡}|dur@t ¡D]\}}t||ƒr$|}q@q$|dur–d|}zt||ƒ}WntypYn&0ddl}|  |›d�t d¡||ƒS|  |¡S)Nr›rz" is deprecated; add visit_Constanté) r"Ú_const_node_type_namesÚgetr!Úitemsr rVrWÚwarningsÚwarnÚDeprecationWarningrœ) r�rr"Ú type_namer`raržrŸr¥rrrÚvisit_Constant¥s&   ÿzNodeVisitor.visit_ConstantN)r[Ú __module__Ú __qualname__Ú__doc__r rœr©rrrrrš�s ršc@seZdZdZdd„ZdS)ÚNodeTransformeraC A :class:`NodeVisitor` subclass that walks the abstract syntax tree and allows modification of nodes. The `NodeTransformer` will walk the AST and use the return value of the visitor methods to replace or remove the old node. If the return value of the visitor method is ``None``, the node will be removed from its location, otherwise it is replaced with the return value. The return value may be the original node in which case no replacement takes place. Here is an example transformer that rewrites all occurrences of name lookups (``foo``) to ``data['foo']``:: class RewriteName(NodeTransformer): def visit_Name(self, node): return Subscript( value=Name(id='data', ctx=Load()), slice=Constant(value=node.id), ctx=node.ctx ) Keep in mind that if the node you're operating on has child nodes you must either transform the child nodes yourself or call the :meth:`generic_visit` method for the node first. For nodes that were part of a collection of statements (that applies to all statement nodes), the visitor may also return a list of nodes rather than just a single node. Usually you use the transformer like this:: node = YourTransformer().visit(node) cCs°t|ƒD]¢\}}t|tƒrvg}|D]D}t|tƒr\| |¡}|durFq"nt|tƒs\| |¡q"| |¡q"||dd…<qt|tƒr| |¡}|duržt||ƒqt|||ƒq|Sr) r|r r1rTr r™rXÚdelattrro)r�rr{Ú old_valueZ new_valuesr"rprrrrœßs&         zNodeTransformer.generic_visitN)r[rªr«r¬rœrrrrr­»s#r­rycCs|jS)zDeprecated. Use value instead.©r"©r�rrrÚ_getterûsr²cCs ||_dSrr°©r�r"rrrÚ_setterÿsr´c@seZdZdd„Zdd„ZdS)Ú_ABCcGs d|_dS)Nz3Deprecated AST node class. Use ast.Constant instead)r¬)r`r6rrrÚ__init__sz _ABC.__init__cCsdt|tƒsdS|tvrXz |j}Wnty4YdS0t|t|ƒoVt|t |d¡ƒ St ||¡S)NFr) r r Ú _const_typesr"rWÚ_const_types_notr£r!Ú__instancecheck__)r`Úinstr"rrrr¹ s   þz_ABC.__instancecheck__N)r[rªr«r¶r¹rrrrrµsrµcOsp|D]<}||jvrq|j |¡}|t|ƒkrt|j›d|›�ƒ‚q|tvrXt|i|¤ŽStj|g|¢Ri|¤ŽS)Nz" got multiple values for argument )rUÚindexr9rgr[r·r Ú__new__)r`r6ÚkwargsÚkeyÚposrrrÚ_news   rÀc@seZdZdZeZdS)ÚNum)ryN©r[rªr«rUrÀr¼rrrrrÁ%srÁ)Ú metaclassc@seZdZdZeZdS)rƒ©r„NrÂrrrrrƒ)srƒc@seZdZdZeZdS)ÚBytesrÄNrÂrrrrrÅ-srÅc@seZdZeZdS)Ú NameConstantN)r[rªr«rÀr¼rrrrrÆ1srÆc@seZdZdZdd„ZdS)ÚEllipsisrcOs6|turtdg|¢Ri|¤ŽStj|g|¢Ri|¤ŽS)N.)rÇr r¼)r`r6r½rrrr¼7szEllipsis.__new__N)r[rªr«rUr¼rrrrrÇ4srÇ.c@seZdZdZdS)ÚslicezDeprecated AST node class.N©r[rªr«r¬rrrrrÈRsrÈc@seZdZdZdd„ZdS)ÚIndexz@Deprecated AST node class. Use the index value directly instead.cKs|Srr)r`r"r½rrrr¼Wsz Index.__new__N©r[rªr«r¬r¼rrrrrÊUsrÊc@seZdZdZddd„ZdS)ÚExtSlicez1Deprecated AST node class. Use ast.Tuple instead.rcKstt|ƒtƒfi|¤ŽSr)r-r1ZLoad)r`Údimsr½rrrr¼\szExtSlice.__new__N)rrËrrrrrÌZsrÌrÍcCs|jS)zDeprecated. Use elts instead.©r/r±rrrÚ _dims_getterdsrÏcCs ||_dSrrÎr³rrrÚ _dims_setterhsrÐc@seZdZdZdS)ÚSuiteú/Deprecated AST node class. Unused in Python 3.NrÉrrrrrÑmsrÑc@seZdZdZdS)ÚAugLoadrÒNrÉrrrrrÓpsrÓc@seZdZdZdS)ÚAugStorerÒNrÉrrrrrÔssrÔc@seZdZdZdS)ÚParamrÒNrÉrrrrrÕvsrÕZ1ec@s‚eZdZdZeƒZeƒZeƒZeƒZeƒZ eƒZ eƒZ eƒZ e Z eƒZeƒZeƒZeƒZeƒZeƒZeƒZeƒZeƒZdd„ZdS)Ú _Precedencez5Precedence table that originated from python grammar.cCs,z| |d¡WSty&|YS0dS©NrH)rZrr±rrrÚnext•s z_Precedence.nextN)r[rªr«r¬rÚTUPLEÚYIELDÚTESTÚORÚANDÚNOTÚCMPÚEXPRÚBORÚBXORÚBANDÚSHIFTÚARITHÚTERMÚFACTORÚPOWERÚAWAITÚATOMrØrrrrrÖ~s(rÖ)ú'ú")z"""z'''csÈeZdZdZddœdd„Zdd„Zdd „Zd d „Zdàd d„Zdd„Z dd„Z e dd„ƒZ e ddœdd„ƒZe dd„ƒZdd„Zdd„Zdd „Zd!d"„Zd#d$„Zd%d&„Z‡fd'd(„Zd)d*„Zd+d,„Zd-d.„Zd/d0„Zd1d2„Zd3d4„Zd5d6„Zd7d8„Zd9d:„Zd;d<„Z d=d>„Z!d?d@„Z"dAdB„Z#dCdD„Z$dEdF„Z%dGdH„Z&dIdJ„Z'dKdL„Z(dMdN„Z)dOdP„Z*dQdR„Z+dSdT„Z,dUdV„Z-dWdX„Z.dYdZ„Z/d[d\„Z0d]d^„Z1d_d`„Z2dadb„Z3dcdd„Z4dedf„Z5dgdh„Z6didj„Z7dkdl„Z8dmdn„Z9dodp„Z:e;ddqœdrds„Zdydz„Z?d{d|„Z@d}d~„ZAdd€„ZBd�d‚„ZCdƒd„„ZDd…d†„ZEd‡dˆ„ZFd‰dŠ„ZGd‹dŒ„ZHd�dŽ„ZId�d�„ZJd‘d’„ZKd“d”„ZLd•d–„ZMd—d˜„ZNd™dš„ZOd›dœ„ZPd�dždŸd d¡œZQeRjSeRjTeRjTeRjTd¢œZUd£d¤„ZVdŸd d¥d¦d§d¨d©dªd«d¬d­d®d¯d°œ ZWeRjXeRjXeRjYeRjYeRjYeRjYeRjZeRjZeRj[eRj\eRj]eRjYeRj^d±œ Z_e`d²ƒZad³d´„Zbdµd¶d·d¸d¹dºd»d¼d½d¾d¿œ ZcdÀdÁ„ZddÂdÃdÄœZeeRjfeRjgdÅœZhdÆdÇ„ZidÈdÉ„ZjdÊdË„ZkdÌdÍ„ZldÎdÏ„ZmdÐdÑ„ZndÒdÓ„ZodÔdÕ„ZpdÖdׄZqdØdÙ„ZrdÚdÛ„ZsdÜdÝ„ZtdÞdß„Zu‡ZvS)áÚ _Unparserz�Methods in this class recursively traverse an AST and output source code for the abstract syntax; original formatting is disregarded.F©Ú_avoid_backslashescCs(g|_g|_i|_i|_d|_||_dS)Nr)Ú_sourceÚ_bufferÚ _precedencesÚ _type_ignoresÚ_indentrï)r�rïrrrr¶¥s z_Unparser.__init__cCsHt|ƒ}z|t|ƒƒWnty*Yn0|D]}|ƒ||ƒq0dS)z7Call f on each item in seq, calling inter() in between.N)ÚiterrØÚ StopIteration)r�ZinterÚfÚseqrOrrrÚ interleave­s z_Unparser.interleavecs>t|ƒdkr$||dƒˆ d¡nˆ ‡fdd„||¡dS)z§Traverse and separate the given *items* with a comma and append it to the buffer. If *items* is a single item sequence, a trailing comma will be added.rHrú,cs ˆ d¡S©NrK©Úwriterr±rrÚÁrSz&_Unparser.items_view..N)r9rýrù)r�Z traverserr¤rr±rÚ items_view¹s   z_Unparser.items_viewcCs|jr| d¡dS)z8Adds a newline if it isn't the start of generated sourcerIN)rðrýr±rrrÚ maybe_newlineÃsz_Unparser.maybe_newlinerJcCs | ¡| d|j|¡dS)zXIndent a piece of text and append it, according to the current indentation levelz N)rrýrô©r�r†rrrÚfillÈsz_Unparser.fillcCs|j |¡dS)zAppend a piece of textN)rðrXrrrrrýÎsz_Unparser.writecCs|j |¡dSr)rñrXrrrrÚ buffer_writerÒsz_Unparser.buffer_writercCsd |j¡}|j ¡|S)NrJ)r\rñÚclearr³rrrÚbufferÕs  z_Unparser.bufferN©Úextraccs>| d¡|r| |¡|jd7_dV|jd8_dS)aA context manager for preparing the source for blocks. It adds the character':', increases the indentation on enter and decreases the indentation on exit. If *extra* is given, it will be directly appended after the colon character. ú:rHN)rýrô)r�rrrrÚblockÛs   z_Unparser.blockccs| |¡dV| |¡dS)z‡A context manager for preparing the source for expressions. It adds *start* to the buffer and enters, after exit it adds *end*.Nrü)r�ÚstartÚendrrrÚdelimités z_Unparser.delimitcCs|r| ||¡StƒSdSr)r r)r�r r Ú conditionrrrÚ delimit_ifòs z_Unparser.delimit_ifcCs| dd| |¡|k¡S)z,Shortcut to adding precedence related parensú(ú))rÚget_precedence)r�Ú precedencerrrrÚrequire_parensøsz_Unparser.require_parenscCs|j |tj¡Sr)ròr£rÖrÛ©r�rrrrrüsz_Unparser.get_precedencecGs|D]}||j|<qdSr)rò)r�rZnodesrrrrÚset_precedenceÿsz_Unparser.set_precedencecCs`t|ttttfƒr t|jƒdkr$dS|jd}t|tƒs| |¡}r.| |¡| |jdd…¡n | |j¡dSr×)rÚ_write_docstringrrE)r�rZ docstringrrrÚ"_write_docstring_and_traverse_body&s z,_Unparser._write_docstring_and_traverse_bodycCs*dd„|jDƒ|_| |¡|j ¡dS)NcSsi|]}|jd|j›�“qS)Úignore)riÚtag)rNrrrrÚ .sÿz*_Unparser.visit_Module..)Ú type_ignoresrórrrrrrÚ visit_Module-s þ z_Unparser.visit_Modulecs`ˆ dd¡�*ˆ ‡fdd„ˆj|j¡Wdƒn1s<0Yˆ d¡ˆ |j¡dS)Nrrcs ˆ d¡Srûrürr±rrrþ8rSz._Unparser.visit_FunctionType..ú -> )r rùrÚargtypesrýÚreturnsrrr±rÚvisit_FunctionType5s ÿ" z_Unparser.visit_FunctionTypecCs(| ¡| tj|j¡| |j¡dSr)rrrÖrÚr"rrrrrÚ visit_Expr>sz_Unparser.visit_ExprcCsh| tj|¡�F| tj|j|j¡| |j¡| d¡| |j¡Wdƒn1sZ0YdS)Nz := ) rrÖrÙrrêÚtargetr"rrýrrrrÚvisit_NamedExprCs   z_Unparser.visit_NamedExprcs(ˆ d¡ˆ ‡fdd„ˆj|j¡dS)Nzimport cs ˆ d¡Srûrürr±rrrþLrSz(_Unparser.visit_Import..)rrùrÚnamesrrr±rÚ visit_ImportJs z_Unparser.visit_ImportcsTˆ d¡ˆ d|j¡|jr,ˆ |j¡ˆ d¡ˆ ‡fdd„ˆj|j¡dS)Nzfrom Ú.z import cs ˆ d¡Srûrürr±rrrþTrSz,_Unparser.visit_ImportFrom..)rrýrQÚmodulerùrr*rrr±rÚvisit_ImportFromNs    z_Unparser.visit_ImportFromcCsP| ¡|jD]}| |¡| d¡q| |j¡| |¡}rL| |¡dS)Nú = )rÚtargetsrrýr"r)r�rr(rrrrÚ visit_AssignVs    z_Unparser.visit_AssigncCsB| ¡| |j¡| d|j|jjjd¡| |j¡dS)Nrfz= ) rrr(rýÚbinopr'rZr[r"rrrrÚvisit_AugAssign_s z_Unparser.visit_AugAssigncCsˆ| ¡| dd|j o"t|jtƒ¡�| |j¡Wdƒn1sH0Y| d¡| |j¡|j r„| d¡| |j ¡dS)Nrrú: r/) rrrbr r(r4rrýÚ annotationr"rrrrÚvisit_AnnAssignes *   z_Unparser.visit_AnnAssigncCs*| d¡|jr&| d¡| |j¡dS)NÚreturnrf)rr"rýrrrrrÚ visit_Returnos  z_Unparser.visit_ReturncCs| d¡dS)NÚpass©rrrrrÚ visit_Passusz_Unparser.visit_PasscCs| d¡dS)NÚbreakr:rrrrÚ visit_Breakxsz_Unparser.visit_BreakcCs| d¡dS)NÚcontinuer:rrrrÚvisit_Continue{sz_Unparser.visit_Continuecs(ˆ d¡ˆ ‡fdd„ˆj|j¡dS)Nzdel cs ˆ d¡Srûrürr±rrrþ€rSz(_Unparser.visit_Delete..)rrùrr0rrr±rÚ visit_Delete~s z_Unparser.visit_DeletecCs6| d¡| |j¡|jr2| d¡| |j¡dS)Nzassert rK)rrÚtestÚmsgrýrrrrÚ visit_Assert‚s    z_Unparser.visit_Assertcs(ˆ d¡ˆ ‡fdd„ˆj|j¡dS)Nzglobal cs ˆ d¡Srûrürr±rrrþ‹rSz(_Unparser.visit_Global..©rrùrýr*rrr±rÚ visit_Global‰s z_Unparser.visit_Globalcs(ˆ d¡ˆ ‡fdd„ˆj|j¡dS)Nz nonlocal cs ˆ d¡Srûrürr±rrrþ�rSz*_Unparser.visit_Nonlocal..rDrrr±rÚvisit_Nonlocal�s z_Unparser.visit_NonlocalcCsh| tj|¡�F| d¡|jrF| d¡| tj|j¡| |j¡Wdƒn1sZ0YdS)NÚawaitrf)rrÖrérýr"rrêrrrrrÚ visit_Await‘s   z_Unparser.visit_AwaitcCsh| tj|¡�F| d¡|jrF| d¡| tj|j¡| |j¡Wdƒn1sZ0YdS)NÚyieldrf)rrÖrÚrýr"rrêrrrrrÚ visit_Yield™s   z_Unparser.visit_YieldcCsf| tj|¡�D| d¡|js(tdƒ‚| tj|j¡| |j¡Wdƒn1sX0YdS)Nz yield from z-Node can't be used without a value attribute.) rrÖrÚrýr"rrrêrrrrrÚvisit_YieldFrom¡s  z_Unparser.visit_YieldFromcCsX| d¡|js"|jrtdƒ‚dS| d¡| |j¡|jrT| d¡| |j¡dS)NÚraisez*Node can't use cause without an exception.rfz from )rÚexcÚcauserrýrrrrrÚ visit_Raise©s    z_Unparser.visit_RaisecCsà| d¡| ¡�| |j¡Wdƒn1s40Y|jD]}| |¡qD|jr˜| d¡| ¡�| |j¡Wdƒn1sŽ0Y|jrÜ| d¡| ¡�| |j¡Wdƒn1sÒ0YdS)NÚtryÚelseÚfinally)rr rrEÚhandlersÚorelseÚ finalbody)r�rÚexrrrÚ visit_Tryµs  *    *  z_Unparser.visit_TrycCsz| d¡|jr&| d¡| |j¡|jrB| d¡| |j¡| ¡�| |j¡Wdƒn1sl0YdS)NÚexceptrfú as )rr!rýrrar rErrrrÚvisit_ExceptHandlerÄs      z_Unparser.visit_ExceptHandlercCsþ| ¡|jD]}| d¡| |¡q| d|j¡|jdd|jpJ|jd��hd}|jD]"}|rp| d¡nd}| |¡q\|jD]"}|rš| d¡nd}| |¡q†Wdƒn1s¾0Y|  ¡�|  |¡Wdƒn1sð0YdS) Nú@zclass rr)r FrKT) rÚdecorator_listrrrarÚbasesr7rýr r)r�rÚdecoÚcommaÚerrrÚvisit_ClassDefÏs&        * z_Unparser.visit_ClassDefcCs| |d¡dS)NÚdef©Ú_function_helperrrrrÚvisit_FunctionDefçsz_Unparser.visit_FunctionDefcCs| |d¡dS)Nz async defrcrrrrÚvisit_AsyncFunctionDefêsz _Unparser.visit_AsyncFunctionDefcCsÔ| ¡|jD]}| d¡| |¡q|d|j}| |¡| dd¡�| |j¡Wdƒn1sn0Y|jr”| d¡| |j¡|j |  |¡d��|  |¡Wdƒn1sÆ0YdS)Nr[rfrrr#r) rr\rrrar r6r%rýr rr)r�rZ fill_suffixr^Zdef_strrrrrdís    *  z_Unparser._function_helpercCs| d|¡dS)Nzfor ©Ú _for_helperrrrrÚ visit_Forüsz_Unparser.visit_ForcCs| d|¡dS)Nz async for rgrrrrÚvisit_AsyncForÿsz_Unparser.visit_AsyncForcCs²| |¡| |j¡| d¡| |j¡|j| |¡d��| |j¡Wdƒn1s`0Y|jr®| d¡| ¡�| |j¡Wdƒn1s¤0YdS)Nú in rrQ) rrr(rýrõr rrErT)r�rrrrrrhs    *  z_Unparser._for_helpercCs| d¡| |j¡| ¡�| |j¡Wdƒn1s@0Y|jrÄt|jƒdkrÄt|jdtƒrÄ|jd}| d¡| |j¡| ¡�| |j¡WdƒqJ1s¸0YqJ|j�r | d¡| ¡�| |j¡Wdƒn1�s0YdS)Nzif rHrzelif rQ) rrrAr rErTr9r ZIfrrrrÚvisit_Ifs   *$    ,  z_Unparser.visit_IfcCs’| d¡| |j¡| ¡�| |j¡Wdƒn1s@0Y|jrŽ| d¡| ¡�| |j¡Wdƒn1s„0YdS)Nzwhile rQ)rrrAr rErTrrrrÚ visit_While s   *  z_Unparser.visit_Whilecsfˆ d¡ˆ ‡fdd„ˆj|j¡ˆjˆ |¡d��ˆ |j¡Wdƒn1sX0YdS)Nzwith cs ˆ d¡Srûrürr±rrrþ,rSz&_Unparser.visit_With..r©rrùrr¤r rrErrr±rÚ visit_With*s z_Unparser.visit_Withcsfˆ d¡ˆ ‡fdd„ˆj|j¡ˆjˆ |¡d��ˆ |j¡Wdƒn1sX0YdS)Nz async with cs ˆ d¡Srûrürr±rrrþ2rSz+_Unparser.visit_AsyncWith..rrnrrr±rÚvisit_AsyncWith0s z_Unparser.visit_AsyncWith©Ú quote_typesÚescape_special_whitespacecs·fdd„}d t|ˆƒ¡‰|}dˆvr6dd„|Dƒ}‡fdd„|Dƒ}|s‚tˆƒ‰t‡fdd „|Dƒˆd ƒ}ˆd d …|gfSˆrÆ|j‡fd d„d�|d d ˆd krƈdd …dˆd ‰ˆ|fS)z‹Helper for writing string literals, minimizing escapes. Returns the tuple (string literal to write, possible quote types). cs4ˆs|dvr|S|dks | ¡s0| d¡ d¡S|S)Nz ú\Zunicode_escapeÚascii)Ú isprintabler�r‘)r‹)rsrrÚ escape_char<s  z2_Unparser._str_literal_helper..escape_charrJrIcSsg|]}|tvr|‘qSr)Ú _MULTI_QUOTES©rNÚqrrrÚ IrSz1_Unparser._str_literal_helper..csg|]}|ˆvr|‘qSrrry©Úescaped_stringrrr{JrSc3s|]}ˆd|vr|VqdSrMrry)ÚstringrrrRPrSz0_Unparser._str_literal_helper..rrHr cs|dˆdkS)Nrr r)rzr|rrrþTrSz/_Unparser._str_literal_helper..)r¾Nrt)r\r.r]rØÚsort)r�r~rrrsrwZpossible_quotesÚquoter)rsr}r~rÚ_str_literal_helper6s z_Unparser._str_literal_helper©rrcCs4|j||d�\}}|d}| |›|›|›�¡dS)zKWrite string literal value with a best effort attempt to avoid backslashes.r‚rN)r�rý)r�r~rrÚ quote_typerrrÚ_write_str_avoiding_backslashes\sz)_Unparser._write_str_avoiding_backslashesc CsÔ| d¡|jr.| ||j¡| |j¡dSg}|jD]:}t|dt|ƒj ƒ}|||jƒ|  |jt |t ƒf¡q8g}t }|D]&\}}|j|||d�\}}|  |¡q€d |¡}|d}| |›|›|›�¡dS)Nr÷Ú _fstring_rqrJr)rýrïÚ_fstring_JoinedStrrr„rr;rVr!r[rXr r Ú _ALL_QUOTESr�r\) r�rrr"ÚmethZ new_bufferrrZ is_constantrƒrrrÚvisit_JoinedStrbs*     þ   z_Unparser.visit_JoinedStrcCs(| d¡| ||j¡| |j¡dS)Nr÷)rýÚ_fstring_FormattedValuerr„rrrrrÚvisit_FormattedValue�s z_Unparser.visit_FormattedValuecCs.|jD]"}t|dt|ƒjƒ}|||ƒqdS)Nr…)r;rVr!r[)r�rrýr"rˆrrrr††s z_Unparser._fstring_JoinedStrcCs6t|jtƒstdƒ‚|j dd¡ dd¡}||ƒdS)Nz.Constants inside JoinedStr should be a string.Ú{z{{Ú}z}})r r"rDrÚreplace)r�rrýr"rrrÚ_fstring_Constant‹s z_Unparser._fstring_ConstantcCsÎ|dƒt|ƒdd�}| tj ¡|j¡| |j¡}| d¡rH|dƒd|vrXtdƒ‚||ƒ|j dkr’t |j ƒ}|dvr„td ƒ‚|d |›�ƒ|j rÂ|d ƒt |d t|j ƒj ƒ}||j |ƒ|d ƒdS)NrŒTrîrfrtz5Unable to avoid backslash in f-string expression partr ZsrazUnknown f-string conversion.ú!rr…r�)r!rrÖrÛrØr"r rnrÚ conversionÚchrÚ format_specrVr[)r�rrýÚunparserÚexprr‘rˆrrrrŠ‘s&     z!_Unparser._fstring_FormattedValuecCs| |j¡dSr)rýr5rrrrÚ visit_Name¦sz_Unparser.visit_NamecCs0| ¡|jdkr| d¡|j|jtd�dS)NÚur‚)rÚkindrýr„r"rxrrrrr©s  z_Unparser._write_docstringc Csjt|ttfƒr<| t|ƒ dt¡ ddt›dt›d�¡¡n*|jrXt|tƒrX|  |¡n| t|ƒ¡dS)NÚinfÚnanrú-r) r r$r%rýr]rŽÚ_INFSTRrïrDr„r³rrrÚ_write_constant¯sÿþÿ z_Unparser._write_constantcCs„|j}t|tƒrL| dd¡�| |j|¡Wdƒq€1s@0Yn4|dur`| d¡n |jdkrt| d¡| |j¡dS)Nrr.ú...r—)r"r rr rÿr�rýr˜)r�rr"rrrr©½s .   z_Unparser.visit_ConstantcsJˆ dd¡�*ˆ ‡fdd„ˆj|j¡Wdƒn1s<0YdS)Nú[ú]cs ˆ d¡Srûrürr±rrrþËrSz&_Unparser.visit_List..)r rùrr/rrr±rÚ visit_ListÉsz_Unparser.visit_ListcCsR| dd¡�2| |j¡|jD]}| |¡q Wdƒn1sD0YdS)NrŸr ©r rÚeltÚ generators©r�rÚgenrrrÚvisit_ListCompÍs  z_Unparser.visit_ListCompcCsR| dd¡�2| |j¡|jD]}| |¡q Wdƒn1sD0YdS©Nrrr¢r¥rrrÚvisit_GeneratorExpÓs  z_Unparser.visit_GeneratorExpcCsR| dd¡�2| |j¡|jD]}| |¡q Wdƒn1sD0YdS)NrŒr�r¢r¥rrrÚ visit_SetCompÙs  z_Unparser.visit_SetCompcCsh| dd¡�H| |j¡| d¡| |j¡|jD]}| |¡q6Wdƒn1sZ0YdS)NrŒr�r4)r rr¾rýr"r¤r¥rrrÚvisit_DictCompßs     z_Unparser.visit_DictCompcCs�|jr| d¡n | d¡| tj|j¡| |j¡| d¡|jtj ¡|j g|j ¢RŽ| |j ¡|j D]}| d¡| |¡qrdS)Nz async for z for rkú if ) Úis_asyncrýrrÖrÙr(rrÛrØrõÚifs)r�rZ if_clauserrrÚvisit_comprehensionçs       z_Unparser.visit_comprehensioncCs’| tj|¡�p| tj ¡|j|j¡| |j¡| d¡| |j¡| d¡| tj|j ¡| |j ¡Wdƒn1s„0YdS)Nr¬z else ) rrÖrÛrrØrErArrýrTrrrrÚ visit_IfExpõs    z_Unparser.visit_IfExpcs\|jrNˆ dd¡�*ˆ ‡fdd„ˆj|j¡WdƒqX1sB0Yn ˆ d¡dS)NrŒr�cs ˆ d¡Srûrürr±rrrþrSz%_Unparser.visit_Set..z{*()})r/r rùrrýrrr±rÚ visit_Setÿs:z_Unparser.visit_Setcsj‡fdd„‰‡‡fdd„}ˆ dd¡�0ˆ ‡fdd„|t|j|jƒ¡Wdƒn1s\0YdS) Ncs"ˆ |¡ˆ d¡ˆ |¡dS©Nr4)rrý)ÚkÚvr±rrÚwrite_key_value_pair s  z2_Unparser.visit_Dict..write_key_value_paircsB|\}}|dur4ˆ d¡ˆ tj|¡ˆ |¡n ˆ||ƒdS)Nú**)rýrrÖràr)r}r³r´©r�rµrrÚ write_items   z(_Unparser.visit_Dict..write_itemrŒr�cs ˆ d¡Srûrürr±rrrþrSz&_Unparser.visit_Dict..)r rùr=r:r;)r�rr¸rr·rÚ visit_Dicts   ÿz_Unparser.visit_DictcCs@| dd¡� | |j|j¡Wdƒn1s20YdSr¨)r rÿrr/rrrrÚ visit_Tuplesz_Unparser.visit_Tupleú~Únotú+r›)ZInvertZNotr(r))r¼r»r½r›cCs‚|j|jjj}|j|}| ||¡�H| |¡|tjurF| d¡|  ||j ¡|  |j ¡Wdƒn1st0YdS©Nrf) Úunopr'rZr[Úunop_precedencerrýrÖrçrr*r)r�rÚoperatorÚoperator_precedencerrrÚ visit_UnaryOp*s    z_Unparser.visit_UnaryOprr[ú/ú%ú<<ú>>ú|ú^ú&ú//r¶) r>r?ZMultZMatMultZDivZModZLShiftZRShiftZBitOrZBitXorZBitAndZFloorDivZPow) r½r›rr[rÄrÅrÆrÇrÈrÉrÊrËr¶)r¶cCs´|j|jjj}|j|}| ||¡�z||jvr@| ¡}|}n |}| ¡}| ||j ¡|  |j ¡|  d|›d�¡| ||j ¡|  |j ¡Wdƒn1s¦0YdSr¾) r2r'rZr[Úbinop_precedencerÚ binop_rassocrØrr@rrýrA)r�rrÁrÂZleft_precedenceZright_precedencerrrÚ visit_BinOpWs   z_Unparser.visit_BinOpz==z!=úz>=Úiszis notÚinznot in) ZEqZNotEqZLtZLtEZGtZGtEZIsZIsNotZInZNotIncCsš| tj|¡�x|jtj ¡|jg|j¢RŽ| |j¡t|j |jƒD].\}}|  d|j |j j d¡| |¡qHWdƒn1sŒ0YdSr¾)rrÖrßrrØr@Ú comparatorsrr=ÚopsrýÚcmpopsrZr[)r�rÚor`rrrÚ visit_Compareus  z_Unparser.visit_CompareÚandÚor)ZAndZOr)rØrÙcs~ˆj|jjj}ˆj|‰‡‡fdd„}ˆ ˆ|¡�6d|›d�‰ˆ ‡‡fdd„||j¡Wdƒn1sp0YdS)Ncs"ˆ ¡‰ˆ ˆ|¡ˆ |¡dSr)rØrrr)rÂr�rrÚincreasing_level_traverse„s z9_Unparser.visit_BoolOp..increasing_level_traverserfcs ˆ ˆ¡Srrür)r„r�rrrþŒrSz(_Unparser.visit_BoolOp..)Úboolopsr'rZr[Úboolop_precedencerrùr;)r�rrÁrÚr)rÂr„r�rÚ visit_BoolOp€s   z_Unparser.visit_BoolOpcCsZ| tj|j¡| |j¡t|jtƒr@t|jjtƒr@| d¡| d¡| |j ¡dS)Nrfr,) rrÖrêr"rr r r#rýrqrrrrÚvisit_AttributeŽs    z_Unparser.visit_AttributecCs¤| tj|j¡| |j¡| dd¡�hd}|jD]"}|rH| d¡nd}| |¡q4|jD]"}|rr| d¡nd}| |¡q^Wdƒn1s–0YdS)NrrFrKT) rrÖrêr3rr r6rýr7)r�rr_r`rrrÚ visit_Call™s      z_Unparser.visit_CallcCs~dd„}| tj|j¡| |j¡| dd¡�:||jƒrP| |j|jj¡n | |j¡Wdƒn1sp0YdS)NcSs&t|tƒo$|jo$tdd„|jDƒƒ S)Ncss|]}t|tƒVqdSr)r ZStarred)rNr£rrrrR³rSzE_Unparser.visit_Subscript..is_simple_tuple..)r r-r/Úany)Z slice_valuerrrÚis_simple_tuple¬s  ÿýz2_Unparser.visit_Subscript..is_simple_tuplerŸr ) rrÖrêr"rr rÈrÿr/)r�rrárrrÚvisit_Subscript«s   z_Unparser.visit_SubscriptcCs*| d¡| tj|j¡| |j¡dS)Nr)rýrrÖràr"rrrrrÚ visit_Starred¾s z_Unparser.visit_StarredcCs| d¡dS)NržrürrrrÚvisit_EllipsisÃsz_Unparser.visit_EllipsiscCsN|jr| |j¡| d¡|jr.| |j¡|jrJ| d¡| |j¡dS)Nr)ÚlowerrrýÚupperÚsteprrrrÚ visit_SliceÆs    z_Unparser.visit_SlicecCs,| |j¡|jr(| d¡| |j¡dSr²)rýÚargr5rrrrrÚ visit_argÐs  z_Unparser.visit_argc Cs¢d}|j|j}dgt|ƒt|jƒ|j}tt||ƒdƒD]^\}}|\}}|rXd}n | d¡| |¡|r„| d¡| |¡|t|jƒkr>| d¡q>|jsª|j rü|r´d}n | d¡| d¡|jrü| |jj ¡|jj rü| d¡| |jj ¡|j �rLt|j |j ƒD]8\}}| d¡| |¡|�r| d¡| |¡�q|j �rž|�r`d}n | d¡| d |j j ¡|j j �rž| d¡| |j j ¡dS) NTrHFrKú=z, /rr4r¶)Ú posonlyargsr6r9ÚdefaultsÚ enumerater=rýrÚvarargÚ kwonlyargsrér5Ú kw_defaultsÚkwarg) r�rr“Zall_argsrír»ÚelementsÚaÚdrrrÚvisit_argumentsÖsN                z_Unparser.visit_argumentscCs<|jdur| d¡n| |j¡| d¡| |j¡dS)Nr¶rë)rérýrr"rrrrÚ visit_keyword s     z_Unparser.visit_keywordcCsn| tj|¡�L| d¡| |j¡| d¡| tj|j¡| |j¡Wdƒn1s`0YdS)Nzlambda r4)rrÖrÛrýrr6rrErrrrÚ visit_Lambdas    z_Unparser.visit_LambdacCs&| |j¡|jr"| d|j¡dS©NrY)rýraÚasnamerrrrÚ visit_aliass z_Unparser.visit_aliascCs,| |j¡|jr(| d¡| |j¡dSrù)rÚ context_exprÚ optional_varsrýrrrrÚvisit_withitems  z_Unparser.visit_withitem)rJ)wr[rªr«r¬r¶rùrÿrrrýrÚpropertyrrr r rrrrrrrr rr"r&r'r)r+r.r1r3r6r8r;r=r?r@rCrErFrHrJrKrOrWrZrarerfrdrirjrhrlrmrorpr‡r�r„r‰r‹r†r�rŠr–rr�r©r¡r§r©rªr«r¯r°r±r¹rºr¿rÖrÞrçrÀrÃr2rårærärárârãrèrÌÚ frozensetrÍrÎrÕr×rÛrÝrÜrÜrÝrÞrßrârãrärèrêrör÷rørûrþÚ __classcell__rrrrrí s              ÿ &   ü óóö    3rícCstƒ}| |¡Sr)rír )Zast_objr”rrrÚunparse$srcCsäddl}|jdd�}|jd|jdd�ddd d �|jd d d ddd�|jddddd�|jddddd�|jddtddd�| ¡}|j�}| ¡}Wdƒn1s¨0Yt||jj |j |j d �}t t ||j|jd!�ƒdS)"Nrz python -m ast)ÚprogÚinfileÚrbrú?r›z$the file to parse; defaults to stdin)r!ÚnargsÚdefaultÚhelpz-mz--moder)rZsinglerZ func_typez(specify what kind of code must be parsed)rÚchoicesr z--no-type-commentsTÚ store_falsez)don't add information about type comments)rÚactionr z-az--include-attributesÚ store_truez:include attributes such as line numbers and column offsets)r r z-iz--indentrLz'indentation of nodes (number of spaces))r!rr )r )rerG)ÚargparseÚArgumentParserÚ add_argumentÚFileTyper#Ú parse_argsrÚreadrrarZno_type_commentsÚprintrhrerG)rÚparserr6rrZtreerrrÚmain)s0 þ þ ÿ ÿ ÿ&rÚ__main__)rr)TF)rH)T)Kr¬ÚsysZ_astÚ contextlibrrÚenumrrrrFrhrrrwrzr|rsr‡rŒrŽr•rxÚobjectršr­rmr r²r´rÿryr„r!rµrÀrÁrƒrÅrÆrÇr#r$r%rDÚbytesÚboolr·r¸r¢rTrÈrÊrÌr-rÏrÐrÍÚmodrÑZ expr_contextrÓrÔrÕr]Ú float_infoÚ max_10_exprœrÖZ_SINGLE_QUOTESrxr‡rírrr[rrrrÚsœÿ 8C#    %:<       ûÿø