Hacked By AnonymousFox

Current Path : /opt/alt/python39/lib64/python3.9/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/__pycache__/ast.cpython-39.opt-1.pyc

a

R�fs��@s�dZddlZddlTddlmZmZddlmZmZd`ddd	�d
d�Z	dd
�Z
dadd�dd�Zdd�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%Gd<d=�d=ee!d7�Z&Gd>d?�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;�Z<GdPdQ�dQe;�Z=GdRdS�dSe;�Z>dTe?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�	<unknown>�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�(/opt/alt/python39/lib64/python3.9/ast.py�parse!s

�rcs`t|t�rt|dd�}t|t�r&|j}dd���fdd���fdd������fd	d
���|�S)a
    Safely evaluate an expression node or a string containing 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.
    �eval�rcSstd|����dS)Nzmalformed node or string: )�
ValueError��noderrr�_raise_malformed_nodeAsz+literal_eval.<locals>._raise_malformed_nodecs,t|t�rt|j�tttfvr&�|�|jS�N)r
�Constant�type�value�int�float�complexr)rrr�_convert_numCsz"literal_eval.<locals>._convert_numcsDt|t�r<t|jttf�r<�|j�}t|jt�r6|
S|S�|�Sr)r
ZUnaryOp�op�UAdd�USub�operand)rr*)r&rr�_convert_signed_numGs
z)literal_eval.<locals>._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+rrrrCOs<




���


�

zliteral_eval.<locals>._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<t||d�du�r<q�|	��\}	}
|�oR|
}|�d||	f�q�|�r�t|�d	k�r�d
|j	j
d�|�f|fSd|j	j
||�|�fdfSt|t��r�|�s�d
Sd||���fdd�|D��fdfSt
|�dfS)N��
z,
��, T.z%s=%s�z%s(%s)z%s(%s%s)F)z[]Tz[%s%s]c3s|]}�|��dVqdS�rNr)�.0�x)�_format�levelrr�	<genexpr>��z(dump.<locals>._format.<locals>.<genexpr>)r
�ASTr!�_fields�getattr�AttributeError�append�_attributesr9�	__class__�__name__�joinr1�repr)rrQ�prefix�sep�clsr6Z	allsimpler7�namer"�simple�rP�annotate_fields�include_attributesrG)rQrrPxsX




&zdump.<locals>._formatzexpected AST, got %rN� )r)r
rT�	TypeErrorrZr[rD)rrdrerGrrcr�dumpls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.<locals>._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<dS|jdj
}t|t�rZ|j}n"t|t
�rxt|j
t�rx|j
}ndS|r�ddl}|�|�}|S)aC
    Return the docstring for the given node or None if no docstring can
    be found.  If the node provided does not have docstrings a TypeError
    will be raised.

    If *clean* is `True`, all tabs are expanded to spaces and any whitespace
    that can be uniformly removed from the second line onwards is removed.
    z%r can't have docstringsrN)r
�AsyncFunctionDef�FunctionDef�ClassDef�ModulergrZr[rE�Exprr"�Str�sr rD�inspectZcleandoc)rZclean�textr�rrr�
get_docstrings	

r�cCs�d}g}d}|t|�krx||}||7}|d7}|dkr`|t|�kr`||dkr`|d7}|d7}|dvr|�|�d}q|r�|�|�|S)z}Split a string into lines ignoring form feed and other chars.

    This mimics how the Python parser splits source code.
    rrJrH�
rIz
)r9rX)r�idx�linesZ	next_line�crrr�_splitlines_no_ff(s  

r�cCs,d}|D]}|dvr||7}q|d7}q|S)z6Replace all chars except '\f\t' in a line with spaces.rJz	rfr)r�resultr�rrr�_pad_whitespaceAs

r�)�paddedcCsz>|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�firstZlastrrr�get_source_segmentLs*	



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�Ztodorrrrxqs
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"Z	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�/sr�c@seZdZdZdd�ZdS)�EllipsisrcOs6|turtdg|�Ri|��Stj|g|�Ri|��S)N.)r�r r�)r`r6r�rrrr�5szEllipsis.__new__N)r[r�r�rUr�rrrrr�2sr�.c@seZdZdZdS)�slicezDeprecated AST node class.N�r[r�r�r�rrrrr�Psr�c@seZdZdZdd�ZdS)�Indexz@Deprecated AST node class. Use the index value directly instead.cKs|Srr)r`r"r�rrrr�Usz
Index.__new__N�r[r�r�r�r�rrrrr�Ssr�c@seZdZdZddd�ZdS)�ExtSlicez1Deprecated AST node class. Use ast.Tuple instead.rcKstt|�t�fi|��Sr)r-r1ZLoad)r`�dimsr�rrrr�ZszExtSlice.__new__N)rr�rrrrr�Xsr�r�cCs|jS)zDeprecated. Use elts instead.�r/r�rrr�_dims_getterbsr�cCs
||_dSrr�r�rrr�_dims_setterfsr�c@seZdZdZdS)�Suite�/Deprecated AST node class.  Unused in Python 3.Nr�rrrrr�ksr�c@seZdZdZdS)�AugLoadr�Nr�rrrrr�nsr�c@seZdZdZdS)�AugStorer�Nr�rrrrr�qsr�c@seZdZdZdS)�Paramr�Nr�rrrrr�tsr�Z1ec@s�eZdZdZe�Ze�Ze�Ze�Ze�Z	e�Z
e�Ze�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
edd��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�Z<e;dt�dudv�Z=dwdx�Z>dydz�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�dDŽ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�<lambda>�rSz&_Unparser.items_view.<locals>.<lambda>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)r�r�r��r�r�rrr�fill�sz_Unparser.fillcCs|j�|�dS)zAppend a piece of textN)r�rXr�rrrr��sz_Unparser.writecCs|j�|�dSr)r�rXr�rrr�
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�rr	�	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<dS|j}t|t	�r\t|jt
�r\|SdS)z�If a docstring node is found in the body of the *node* parameter,
        return that docstring node, None otherwise.

        Logic mirrored from ``_PyAST_GetDocString``.rHNr)r
r~rr�r�r9rEr�r"r rDrrrr�get_raw_docstrings��

z_Unparser.get_raw_docstringcCs*|j�|j�p|j}|dur&d|��SdS)Nz	 # type: )r�r�ri�type_comment)r�rZcommentrrr�get_type_commentsz_Unparser.get_type_commentcs0t|t�r |D]}|�|�qnt��|�dSr)r
r1�traverse�superr�)r�rr}�rZrrrs
z_Unparser.traversecCsg|_|�|�d�|j�S)z�Outputs a source code string that, if converted back to an ast
        (using ast.parse) will generate an AST equivalent to *node*rJ)r�rr\rrrrr�s
z_Unparser.visitcCs>|�|�}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�
<dictcomp>,s�z*_Unparser.visit_Module.<locals>.<dictcomp>)�type_ignoresr�rrrrrr�visit_Module+s
�
z_Unparser.visit_Modulecs`��dd��*���fdd��j|j�Wd�n1s<0Y��d���|j�dS)Nr
rcs
��d�Sr�r�rr�rrr�6rSz._Unparser.visit_FunctionType.<locals>.<lambda>� -> )r
r�r�argtypesr��returnsrrr�r�visit_FunctionType3s�"
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_NamedExprAs

z_Unparser.visit_NamedExprcs(��d����fdd��j|j�dS)Nzimport cs
��d�Sr�r�rr�rrr�JrSz(_Unparser.visit_Import.<locals>.<lambda>)rr�r�namesrrr�r�visit_ImportHs
z_Unparser.visit_ImportcsT��d���d|j�|jr,��|j���d����fdd��j|j�dS)Nzfrom �.z import cs
��d�Sr�r�rr�rrr�RrSz,_Unparser.visit_ImportFrom.<locals>.<lambda>)rr�rQ�moduler�rr(rrr�r�visit_ImportFromLs

z_Unparser.visit_ImportFromcCsP|��|jD]}|�|�|�d�q|�|j�|�|�}rL|�|�dS)N� = )r�targetsrr�r"r)r�rr&rrrr�visit_AssignTs

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)Nr
r�: r-)
rrrbr
r&r4rr��
annotationr"rrrr�visit_AnnAssigncs *

z_Unparser.visit_AnnAssigncCs*|�d�|jr&|�d�|�|j�dS)N�returnrf)rr"r�rrrrr�visit_Returnms

z_Unparser.visit_ReturncCs|�d�dS)N�pass�rrrrr�
visit_Passssz_Unparser.visit_PasscCs|�d�dS)N�breakr8rrrr�visit_Breakvsz_Unparser.visit_BreakcCs|�d�dS)N�continuer8rrrr�visit_Continueysz_Unparser.visit_Continuecs(��d����fdd��j|j�dS)Nzdel cs
��d�Sr�r�rr�rrr�~rSz(_Unparser.visit_Delete.<locals>.<lambda>)rr�rr.rrr�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.<locals>.<lambda>�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.<locals>.<lambda>rBrrr�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)Nzyield 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)rrrrE�handlers�orelse�	finalbody)r�rZexrrr�	visit_Try�s

*


*

z_Unparser.visit_TrycCsz|�d�|jr&|�d�|�|j�|jrB|�d�|�|j�|���|�|j�Wd�n1sl0YdS)N�exceptrf� as )rr!r�rrarrErrrr�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 r
r)rFrKT)r��decorator_listrrrar�basesr7r�rr)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 defr`rrrr�visit_AsyncFunctionDef�sz _Unparser.visit_AsyncFunctionDefcCs�|��|jD]}|�d�|�|�q|d|j}|�|�|�dd��|�|j�Wd�n1sn0Y|jr�|�d�|�|j�|j	|�
|�d��|�|�Wd�n1s�0YdS)NrXrfr
rr!r)r�rYrrrar
r6r#r�rrr)r�rZfill_suffixr[Zdef_strrrrra�s


*
z_Unparser._function_helpercCs|�d|�dS)Nzfor ��_for_helperrrrr�	visit_For�sz_Unparser.visit_ForcCs|�d|�dS)Nz
async for rdrrrr�visit_AsyncFor�sz_Unparser.visit_AsyncForcCs�|�|�|�|j�|�d�|�|j�|j|�|�d��|�|j�Wd�n1s`0Y|jr�|�d�|���|�|j�Wd�n1s�0YdS)N� in rrO)	rrr&r�r�rrrErR)r�rrrrrres

*

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 rO)	rrr?rrErRr9r
ZIfrrrr�visit_Ifs

*$


,

z_Unparser.visit_IfcCs�|�d�|�|j�|���|�|j�Wd�n1s@0Y|jr�|�d�|���|�|j�Wd�n1s�0YdS)Nzwhile rO)rrr?rrErRrrrr�visit_Whiles

*

z_Unparser.visit_Whilecsf��d����fdd��j|j��j��|�d����|j�Wd�n1sX0YdS)Nzwith cs
��d�Sr�r�rr�rrr�*rSz&_Unparser.visit_With.<locals>.<lambda>r�rr�rr�rrrErrr�r�
visit_With(s
z_Unparser.visit_Withcsf��d����fdd��j|j��j��|�d����|j�Wd�n1sX0YdS)Nzasync with cs
��d�Sr�r�rr�rrr�0rSz+_Unparser.visit_AsyncWith.<locals>.<lambda>rrkrrr�r�visit_AsyncWith.s
z_Unparser.visit_AsyncWith��quote_types�escape_special_whitespacecs��fdd�}d�t|����|}d�vr6dd�|D�}�fdd�|D�}|s�t���t�fdd	�|D��d
�}�dd�|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�)rprr�escape_char:s
z2_Unparser._str_literal_helper.<locals>.escape_charrJrIcSsg|]}|tvr|�qSr)�
_MULTI_QUOTES�rN�qrrr�
<listcomp>GrSz1_Unparser._str_literal_helper.<locals>.<listcomp>csg|]}|�vr|�qSrrrv��escaped_stringrrrxHrSc3s|]}�d|vr|VqdSrMrrv)�stringrrrRNrSz0_Unparser._str_literal_helper.<locals>.<genexpr>rrHrcs|d�dkS)Nrrr)rwryrrr�RrSz/_Unparser._str_literal_helper.<locals>.<lambda>)r�Nrq)r\r.r]r��sort)r�r{rorprtZpossible_quotesZquoter)rprzr{r�_str_literal_helper4s
z_Unparser._str_literal_helper�rocCs4|j||d�\}}|d}|�|�|�|���dS)zKWrite string literal value with a best effort attempt to avoid backslashes.r~rN)r}r�)r�r{ro�
quote_typerrr�_write_str_avoiding_backslashesZsz)_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_rnrJr)r�r��_fstring_JoinedStrrr�rr;rVr!r[rXr
r �_ALL_QUOTESr}r\)	r�rrr"�methZ
new_bufferroZis_constantrrrr�visit_JoinedStr`s*

�

z_Unparser.visit_JoinedStrcCs(|�d�|�||j�|�|j�dS)Nr�)r��_fstring_FormattedValuerr�rrrrr�visit_FormattedValues
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
|���|jr�|d�t|dt|j�j
�}||j|�|d
�dS)Nr�Tr�rfrqz5Unable to avoid backslash in f-string expression partrZsrazUnknown 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"rurrrrr�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)Nr
r.�...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.<locals>.<lambda>)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�Nr
rr�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�r2)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 rh� 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�rEr?rr�rRrrrr�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.<locals>.<lambda>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�Nr2)rr�)�k�vr�rr�write_key_value_pairs

z2_Unparser.visit_Dict.<locals>.write_key_value_paircsB|\}}|dur4��d���tj|���|�n
�||�dS)N�**)r�rr�r�r)r}r�r��r�r�rr�
write_items
z(_Unparser.visit_Dict.<locals>.write_itemr�r�cs
��d�Sr�r�rr�rrr�rSz&_Unparser.visit_Dict.<locals>.<lambda>)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_UnaryOprrX�/�%�<<�>>�|�^�&�//r�)
r>r?ZMultZMatMultZDivZModZLShiftZRShiftZBitOrZBitXorZBitAndZFloorDivZPow)
r�r�rrXr�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�)
r0r'rZr[�binop_precedencer�binop_rassocr�rr@rr�rA)r�rr�r�Zleft_precedenceZright_precedencerrr�visit_BinOpUs

z_Unparser.visit_BinOpz==z!=�<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_Comparess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.<locals>.increasing_level_traverserfcs
����Srr�r)r�r�rrr��rSz(_Unparser.visit_BoolOp.<locals>.<lambda>)�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)Nr
rFrKT)	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.<locals>.is_simple_tuple.<locals>.<genexpr>)r
r-r/�any)Zslice_valuerrr�is_simple_tuple�s

��z2_Unparser.visit_Subscript.<locals>.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��argr3rrrrr�	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
�|jjr�|�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, /rr2r�)�posonlyargsr6r9�defaults�	enumerater=r�r�vararg�
kwonlyargsr�r3�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_keywords


z_Unparser.visit_keywordcCsn|�tj|��L|�d�|�|j�|�d�|�tj|j�|�|j�Wd�n1s`0YdS)Nzlambda r2)rr�r�r�rr6rrErrrr�visit_Lambdas

z_Unparser.visit_LambdacCs&|�|j�|jr"|�d|j�dS�NrV)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�r�rr�r�propertyrrrr
rrrrrrrr�rr r$r%r'r)r,r/r1r4r6r9r;r=r>rArCrDrFrHrIrMrTrWr^rbrcrarfrgrerirjrlrmr�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�r0r�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"sr�cCs�ddl}|jdd�}|jd|jdd�ddd	d
�|jddd
ddd�|jddddd�|jddddd�|jddtddd�|��}|j�}|��}Wd�n1s�0Yt||jj	|j
|jd �}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�choicesrz--no-type-commentsTZstore_falsez)don't add information about type comments)r�actionrz-az--include-attributes�
store_truez:include attributes such as line numbers and column offsets)rrz-iz--indentrLz'indentation of nodes (number of spaces))r!rr)r	)rerG)�argparse�ArgumentParser�add_argumentZFileTyper#�
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_QUOTESrur�r�r�rr[rrrr�<module>s��6C#

%:<	

���


Hacked By AnonymousFox1.0, Coded By AnonymousFox