AlkantarClanX12

Your IP : 18.223.237.246


Current Path : /opt/alt/python37/lib64/python3.7/lib2to3/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/lib2to3/__pycache__/fixer_util.cpython-37.opt-2.pyc

B

YI~dg;�
@s�ddlmZddlmZmZddlmZddlm	Z	dd�Z
dd�Zd	d
�Zdd�Z
dVdd�Zdd�Zdd�Zdd�Ze�e�fdd�ZdWdd�Zdd�Zdd�ZdXdd�Zd d!�ZdYd"d#�ZdZd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1d2d3d4d5d6d7d8d9h
Zd:d;�Z d<a!d=a"d>a#d?a$d@dA�Z%dBdC�Z&dDdE�Z'dFdG�Z(dHdI�Z)dJdK�Z*dLdM�Z+dNdO�Z,ej-ej.hZ/d[dPdQ�Z0ej.ej-ej1hZ2dRdS�Z3d\dTdU�Z4d
S)]�)�token)�Leaf�Node)�python_symbols)�patcompcCsttj|ttjd�|g�S)N�=)r�syms�argumentrr�EQUAL)�keyword�value�r
�7/opt/alt/python37/lib64/python3.7/lib2to3/fixer_util.py�
KeywordArgsrcCsttjd�S)N�()rr�LPARr
r
r
r�LParensrcCsttjd�S)N�))rr�RPARr
r
r
r�RParensrcCsHt|t�s|g}t|t�s&d|_|g}ttj|ttjddd�g|�S)N� r)�prefix)	�
isinstance�listrrr�atomrrr
)�target�sourcer
r
r�Assigns

rNcCsttj||d�S)N)r)rr�NAME)�namerr
r
r�Name$sr cCs|ttjt�|g�gS)N)rr�trailer�Dot)�obj�attrr
r
r�Attr(sr%cCsttjd�S)N�,)rr�COMMAr
r
r
r�Comma,sr(cCsttjd�S)N�.)rr�DOTr
r
r
rr"0sr"cCs4ttj|��|��g�}|r0|�dttj|��|S)Nr)rrr!�clone�insert_child�arglist)�argsZlparenZrparen�noder
r
r�ArgList4sr0cCs&ttj|t|�g�}|dk	r"||_|S)N)rr�powerr0r)Z	func_namer.rr/r
r
r�Call;sr2cCsttjd�S)N�
)rr�NEWLINEr
r
r
r�NewlineBsr5cCsttjd�S)N�)rrr4r
r
r
r�	BlankLineFsr7cCsttj||d�S)N)r)rr�NUMBER)�nrr
r
r�NumberJsr:cCs"ttjttjd�|ttjd�g�S)N�[�])rrr!rr�LBRACE�RBRACE)Z
index_noder
r
r�	SubscriptMsr?cCsttj||d�S)N)r)rr�STRING)�stringrr
r
r�StringSsrBc	Cs�d|_d|_d|_ttjd�}d|_ttjd�}d|_||||g}|rtd|_ttjd�}d|_|�ttj||g��ttj|ttj	|�g�}ttj
ttjd�|ttjd�g�S)Nr6r�for�in�ifr;r<)
rrrr�appendrrZcomp_ifZ	listmakerZcomp_forrr=r>)	Zxp�fp�itZtestZfor_leafZin_leafZ
inner_argsZif_leaf�innerr
r
r�ListCompWs$
rJcCsZx|D]}|��qWttjd�ttj|dd�ttjddd�ttj|�g}ttj|�}|S)N�fromr)r�import)�removerrrrr�import_as_names�import_from)Zpackage_nameZ
name_leafsZleaf�children�impr
r
r�
FromImportos

rRc	Cs�|d��}|jtjkr"|��}nttj|��g�}|d}|rNdd�|D�}ttjtt|d�t|d��ttj|d��||d��g�g|�}|j	|_	|S)	Nr#�aftercSsg|]}|���qSr
)r+)�.0r9r
r
r�
<listcomp>�sz!ImportAndCall.<locals>.<listcomp>�rZlparZrpar)
r+�typerr-rr1r%r r!r)r/�results�namesr#Z
newarglistrS�newr
r
r�
ImportAndCall�s
Dr[cCs�t|t�r |jt�t�gkr dSt|t�o�t|j�dko�t|jdt�o�t|jdt�o�t|jdt�o�|jdjdko�|jdjdkS)NT�rVr�rr)rrrPrr�lenrr)r/r
r
r�is_tuple�s
r_cCsXt|t�oVt|j�dkoVt|jdt�oVt|jdt�oV|jdjdkoV|jdjdkS)NrrV���r;r<)rrr^rPrr)r/r
r
r�is_list�s
racCsttjt�|t�g�S)N)rrrrr)r/r
r
r�parenthesize�srb�sortedr�set�any�all�tuple�sum�min�max�	enumerateccs(t||�}x|r"|Vt||�}qWdS)N)�getattr)r#r$�nextr
r
r�
attr_chain�s
rnzefor_stmt< 'for' any 'in' node=any ':' any* >
        | comp_for< 'for' any 'in' node=any any* >
     z�
power<
    ( 'iter' | 'list' | 'tuple' | 'sorted' | 'set' | 'sum' |
      'any' | 'all' | 'enumerate' | (any* trailer< '.' 'join' >) )
    trailer< '(' node=any ')' >
    any*
>
z`
power<
    ( 'sorted' | 'enumerate' )
    trailer< '(' arglist<node=any any*> ')' >
    any*
>
FcCsrts&t�t�at�t�at�t�adatttg}x<t|t|d��D](\}}i}|�||�rB|d|krBdSqBWdS)NT�parentr/F)	�
pats_builtrZcompile_pattern�p0�p1�p2�ziprn�match)r/Zpatterns�patternrorXr
r
r�in_special_context�s



rwcCs�|j}|dk	r|jtjkrdS|j}|jtjtjfkr:dS|jtjkrX|j	d|krXdS|jtj
ks�|jtjkr�|dk	r�|jtjks�|j	d|kr�dSdS)NFrVT)
Zprev_siblingrWrr*ror�funcdef�classdef�	expr_stmtrPZ
parametersZ
typedargslistr')r/�prevror
r
r�is_probably_builtin�sr|cCsNxH|dk	rH|jtjkr@t|j�dkr@|jd}|jtjkr@|jS|j}qWdS)Nr]rr6)	rWr�suiter^rPr�INDENTrro)r/�indentr
r
r�find_indentations


r�cCs>|jtjkr|S|��}|jd}|_ttj|g�}||_|S)N)rWrr}r+ror)r/ror}r
r
r�
make_suitesr�cCs(x"|jtjkr"|j}|std��qW|S)Nz,root found before file_input node was found.)rWrZ
file_inputro�
ValueError)r/r
r
r�	find_root&s
r�cCst|t|�|�}t|�S)N)�find_bindingr��bool)�packagerr/Zbindingr
r
r�does_tree_import/sr�cCs|jtjtjfkS)N)rWr�import_namerO)r/r
r
r�	is_import7sr�cCs4dd�}t|�}t|||�r dSd}}xTt|j�D]F\}}||�sFq4x(t|j|d��D]\}}||�sZPqZW||}Pq4W|dkr�xDt|j�D]6\}}|jtjkr�|jr�|jdjtjkr�|d}Pq�W|dkr�t	tj
ttjd�ttj|dd�g�}	nt
|ttj|dd�g�}	|	t�g}
|�|t	tj|
��dS)NcSs |jtjko|jot|jd�S)NrV)rWr�simple_stmtrPr�)r/r
r
r�is_import_stmt>sz$touch_import.<locals>.is_import_stmtrVrrLr)r)r�r�rkrPrWrr�rr@rr�rrrRr5r,)r�rr/r��rootZ
insert_pos�offset�idxZnode2�import_rPr
r
r�touch_import;s4

r�cCs��x�|jD�]�}d}|jtjkrVt||jd�r4|St|t|jd�|�}|rR|}�n4|jtjtjfkr�t|t|jd�|�}|r�|}�n|jtj	k�rt|t|jd�|�}|r�|}nXx�t
|jdd��D]@\}}|jtjkr�|j
dkr�t|t|j|d�|�}|r�|}q�Wnx|jtk�r6|jdj
|k�r6|}nTt|||��rJ|}n@|jtjk�rft|||�}n$|jtjk�r�t||jd��r�|}|r
|�s�|St|�r
|Sq
WdS)Nrr`r]r\�:�rV)rPrWrZfor_stmt�_findr�r�Zif_stmtZ
while_stmtZtry_stmtrkr�COLONr�	_def_syms�_is_import_bindingr�rzr�)rr/r��child�retr9�iZkidr
r
rr�isH
r�cCsX|g}xL|rR|��}|jdkr6|jtkr6|�|j�q|jtjkr|j|kr|SqWdS)N�)�poprW�_block_syms�extendrPrrr)rr/Znodesr
r
rr��sr�cCs�|jtjkr�|s�|jd}|jtjkrtx�|jD]@}|jtjkrT|jdj|krn|Sq.|jtjkr.|j|kr.|Sq.WnL|jtjkr�|jd}|jtjkr�|j|kr�|Sn|jtjkr�|j|kr�|Sn�|jtj	k�r�|r�t
|jd���|kr�dS|jd}|�rtd|��rdS|jtj
k�r,t||��r,|S|jtjk�rd|jd}|jtjk�r�|j|k�r�|Sn6|jtjk�r�|j|k�r�|S|�r�|jtjk�r�|SdS)Nrr]r`r\�as)rWrr�rPZdotted_as_namesZdotted_as_namerrrrO�str�stripr�rNZimport_as_name�STAR)r/rr�rQr�Zlastr9r
r
rr��s@




r�)N)NN)N)N)N)N)N)5Zpgen2rZpytreerrZpygramrrr6rrrrrr r%r(r"r0r2r5r7r:r?rBrJrRr[r_rarbZconsuming_callsrnrqrrrsrprwr|r�r�r�r�r�r�ryrxr�r�r!r�r�r�r
r
r
r�<module>sX





		-
*