a
    Sic;                  h   @   s  d dl Zd dlZd dlmZmZmZmZmZm	Z	 d dlm
Z
mZmZmZmZ d dlmZmZ zd dlmZ W n" ey   G dd deZY n0 dd	 Zd
ddefffdddefffdddefffdddefffdddefffdddefffdddefffdddefffdddefffdddefffdddefffdd defffd!d"defffd#d$defffd%d&defffd'd&defffd(d)defffd*d)defffd+d,defffd-d,defffd.d/defffd0d1defffd2d3defffd4d5defffd6d7defffd8d9defffd:d5defffd;d5defffd<ddefffd=ddefffd>ddefffd?ddefffd@dAdefffdBdCdefffdDdEdefffdFdGdefffdHd)defffdIdJdefffdKdLdefffdMdNdefffdOdNdefffdPdQdefffdRdNdefffdSddefffdTddefffdUddefffdVdWdefffdXdYdefffdZddefffd[d\defffd]d^defffd_d`defffdadbdefffdcdddefffdedfdefffdgdhdefffdidjdefffdkdjdefffdlddefffdmddefffdnddefffdoddefffdpddefffdqddefffdrdsde
fffdtddefffduddefffdvdde	fffdwdde	fffdxdde	fffdydde	fffdzdde	fffd{dde	fffd|dde	fffd}dde	fffd~dde	fffddde	fffddde	fffddde	fffddde	fffdddeefffdddeefffdddeefffdddeefffdddefffdddefffdddefffdddefffdddefffdddefffdddefffdddefffdddefffdddefffdddefffdddefffdddefffdddefffdddefffdddefffdddeffffeZeD ]\ZZeegeR   q.ejjdkrhddlmZmZ ejjdkrddlmZmZ dd Zdd ZdddZdd Z dd Z!dddZ"dS )    N)boolopcmpopexcepthandlerexprexpr_contextoperator)slicestmtunaryopmodAST)iter_child_nodeswalk)
TypeIgnorec                   @   s   e Zd ZdS )r   N)__name__
__module____qualname__ r   r   E/var/www/html/django/DPS/env/lib/python3.9/site-packages/gast/gast.pyr   
   s   r   c                    s2    fdd}t tjt t|d|i d S )Nc                    s   t |t | }|dt fv s6J d|t | _ | _t| j|D ]\}}t| || qN| D ],\}}|v sJ d|t| || qld S )Nr   z,Bad argument number for {}: {}, expecting {}z#Invalid Keyword argument for {}: {})lenformat_fields_attributeszipsetattritems)selfargskwargsZnbparamargnameargval
AttributesFieldsNamer   r   create_node   s    


z_make_node.<locals>.create_node__init__)r   _sysmodulesr   type)r$   r#   r"   ZBasesr%   r   r!   r   
_make_node   s    
r*   Module)bodytype_ignoresr   Interactive)r,   
ExpressionFunctionType)argtypesreturnsSuiteFunctionDef)namer   r,   decorator_listr2   type_commentlineno
col_offset
end_linenoend_col_offsetAsyncFunctionDefClassDef)r5   baseskeywordsr,   r6   Return)valueDelete)targetsAssign)rD   rB   	AugAssign)targetoprB   	AnnAssign)rG   
annotationrB   simplePrint)destvaluesnlFor)rG   iterr,   orelser7   AsyncForWhile)testr,   rR   IfWith)r   r,   r7   	AsyncWithRaise)exccauseTry)r,   handlersrR   	finalbodyAssert)rU   msgImport)names
ImportFrom)modulerb   levelZExec)r,   globalslocalsGlobalNonlocalExprPassBreakContinueBoolOp)rH   rN   BinOp)leftrH   rightUnaryOp)rH   operandLambda)r   r,   IfExpDict)keysrN   Set)eltsListComp)elt
generatorsSetCompDictComp)keyrB   r|   GeneratorExpAwaitYield	YieldFromCompare)rp   opscomparatorsCall)funcr   r@   ReprFormattedValue)rB   
conversionformat_spec	JoinedStr)rN   Constant)rB   kind	Attribute)rB   attrctx	Subscript)rB   r   r   Starred)rB   r   r$   )idr   rJ   r7   List)ry   r   TupleLoadStoreDelAugLoadAugStoreParamSlice)lowerupperstepAndOrAddSubMultMatMultDivModPowLShiftRShiftBitOrBitXorBitAndFloorDivInvertNotUAddUSubEqNotEqLtLtEGtGtEIsIsNotInNotIncomprehension)rG   rQ   ifsis_asyncExceptHandler)r)   r5   r,   	arguments)r   posonlyargsvararg
kwonlyargskw_defaultskwargdefaultskeyword)argrB   alias)r5   asnamewithitem)context_exproptional_varstype_ignore)r9   tag      )ast_to_gastgast_to_ast   c                  O   s   t tj| i |S N)r   _astparse)r   r   r   r   r   r   +  s    r   c                 C   s   t | trt| } t| S r   )
isinstancer   r   r   literal_eval)node_or_stringr   r   r   r   /  s    
r   Tc                 C   s   t | tttfs td| jj | jrt | jd trt | jd j	t
r|rvdd l}| jd j	}|t||jd S | jd j	jS d S )Nz%r can't have docstringsr   )r   r4   r>   r+   	TypeError	__class__r   r,   rj   rB   r   inspectcleandocgetattrr   s)nodecleanr   holderr   r   r   get_docstring5  s    r   c                 C   s>   dD ]4}||j v r|| j v rt||rt| |t|| 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*.
    r8   )r   hasattrr   r   )new_nodeold_noder   r   r   r   copy_locationC  s    r   c                    s     fdd  | dddd | 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*.
    c                    s   d| j v r"t| ds|| _n| j}d| j v rDt| ds>|| _n| j}d| j v rft| ds`|| _n| j}d| j v rt| ds|| _n| j}t| D ]} ||||| qd S )Nr9   r;   r:   r<   )r   r   r9   r;   r:   r<   r   )r   r9   r:   r;   r<   child_fixr   r   r   X  s$    







z#fix_missing_locations.<locals>._fixr   r   r   )r   r   r   r   fix_missing_locationsP  s    r   c                 C   sR   t | D ]D}d|jv r,t|ddp$d| |_d|jv rt|ddpDd| |_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.
    r9   r   r;   )r   r   r   r9   r;   )r   nr   r   r   r   increment_linenos  s    

r   )T)r   )#sysr'   astr   r   r   r   r   r   r   r   r	   r
   r   r   r   r   r   ImportErrorr*   Z_nodesr5   descrversion_infomajorZast2r   r   Zast3r   r   r   r   r   r   r   r   r   r   <module>   sL       
#