Hacked By AnonymousFox

Current Path : /usr/lib64/python3.8/lib2to3/__pycache__/
Upload File :
Current File : //usr/lib64/python3.8/lib2to3/__pycache__/fixer_util.cpython-38.opt-2.pyc

U

e5dg;�
@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�symsZargumentrr�EQUAL)�keyword�value�r�*/usr/lib64/python3.8/lib2to3/fixer_util.py�
KeywordArgs�rcCs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�Nr)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r
r$0sr$cCs4ttj|��|��g�}|r0|�dttj|��|S)Nr)rrr#�clone�insert_child�arglist)�argsZlparenZrparen�noderrr
�ArgList4sr2cCs&ttj|t|�g�}|dk	r"||_|Sr")rr�powerr2r)Z	func_namer0rr1rrr
�Call;sr4cCsttjd�S)N�
�rr�NEWLINErrrr
�NewlineBsr8cCsttjd�S)N�r6rrrr
�	BlankLineFsr:cCsttj||d�Sr)rr�NUMBER)�nrrrr
�NumberJsr=cCs"ttjttjd�|ttjd�g�S)N�[�])rrr#rr�LBRACE�RBRACE)Z
index_noderrr
�	SubscriptMs
�rBcCsttj||d�Sr)rr�STRING)�stringrrrr
�StringSsrEc	Cs�d|_d|_d|_ttjd�}d|_ttjd�}d|_||||g}|rtd|_ttjd�}d|_|�ttj||g��ttj|ttj	|�g�}ttj
ttjd�|ttjd�g�S)Nr9r�for�in�ifr>r?)
rrrr�appendrrZcomp_ifZ	listmakerZcomp_forrr@rA)	Zxp�fp�itZtestZfor_leafZin_leafZ
inner_argsZif_leaf�innerrrr
�ListCompWs(

��rMcCsV|D]}|��qttjd�ttj|dd�ttjddd�ttj|�g}ttj|�}|S)N�fromrr�import)�removerrrrr�import_as_names�import_from)Zpackage_nameZ
name_leafsZleaf�children�imprrr
�
FromImportos


�rUc	Cs�|d��}|jtjkr"|��}nttj|��g�}|d}|rNdd�|D�}ttjtt|d�t|d��ttj|d��||d��g�g|�}|j	|_	|S)	Nr%�aftercSsg|]}|���qSr)r-)�.0r<rrr
�
<listcomp>�sz!ImportAndCall.<locals>.<listcomp>�rZlparZrpar)
r-�typerr/rr3r'r!r#r)r1�results�namesr%Z
newarglistrV�newrrr
�
ImportAndCall�s*


�����r^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�rYr�rr)rrrSrr�lenrr�r1rrr
�is_tuple�s
������rccCsXt|t�oVt|j�dkoVt|jdt�oVt|jdt�oV|jdjdkoV|jdjdkS)NrrY���r>r?)rrrarSrrrbrrr
�is_list�s
�����recCsttjt�|t�g�Sr")rrrrrrbrrr
�parenthesize�srf�sortedr�set�any�all�tuple�sum�min�max�	enumerateccs$t||�}|r |Vt||�}q
dSr")�getattr)r%r&�nextrrr
�
attr_chain�s
rrzefor_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*
>
FcCspts&t�t�at�t�at�t�adatttg}t|t|d��D]*\}}i}|�||�r@|d|kr@dSq@dS)NT�parentr1F)	�
pats_builtrZcompile_pattern�p0�p1�p2�ziprr�match)r1Zpatterns�patternrsr[rrr
�in_special_context�s



r{cCs�|j}|dk	r|jtjkrdS|j}|jtjtjfkr:dS|jtjkrX|j	d|krXdS|jtj
ks�|jtjkr�|dk	r�|jtjks�|j	d|kr�dSdS)NFrYT)
Zprev_siblingrZrr,rsr�funcdef�classdef�	expr_stmtrSZ
parametersZ
typedargslistr))r1�prevrsrrr
�is_probably_builtin�s&
��
��r�cCsJ|dk	rF|jtjkr>t|j�dkr>|jd}|jtjkr>|jS|j}qdS)Nr`rr9)	rZr�suiterarSr�INDENTrrs)r1�indentrrr
�find_indentations
r�cCs>|jtjkr|S|��}|jd}|_ttj|g�}||_|Sr")rZrr�r-rsr)r1rsr�rrr
�
make_suitesr�cCs$|jtjkr |j}|std��q|S)Nz,root found before file_input node was found.)rZrZ
file_inputrs�
ValueErrorrbrrr
�	find_root&s

r�cCst|t|�|�}t|�Sr")�find_bindingr��bool)�packager r1Zbindingrrr
�does_tree_import/sr�cCs|jtjtjfkSr")rZr�import_namerRrbrrr
�	is_import7sr�cCs.dd�}t|�}t|||�r dSd}}t|j�D]F\}}||�sDq2t|j|d��D]\}}||�sVqlqV||}qzq2|dkr�t|j�D]8\}}|jtjkr�|jr�|jdjtjkr�|d}q�q�|dkr�t	tj
ttjd�ttj|dd�g�}	nt
|ttj|dd�g�}	|	t�g}
|�|t	tj|
��dS)NcSs |jtjko|jot|jd�S)NrY)rZr�simple_stmtrSr�rbrrr
�is_import_stmt>s�z$touch_import.<locals>.is_import_stmtrYrrOrr)r�r�rorSrZrr�rrCrr�rrrUr8r.)r�r r1r��rootZ
insert_pos�offset�idxZnode2�import_rSrrr
�touch_import;s8�
�
r�cCs�|jD�]�}d}|jtjkrVt||jd�r4|St|t|jd�|�}|rR|}�n0|jtjtjfkr�t|t|jd�|�}|r�|}�n�|jtj	k�rt|t|jd�|�}|r�|}nTt
|jdd��D]@\}}|jtjkr�|j
dkr�t|t|j|d�|�}|r�|}q�nx|jtk�r2|jdj
|k�r2|}nTt|||��rF|}n@|jtjk�rbt|||�}n$|jtjk�r�t||jd��r�|}|r|�s�|St|�r|SqdS)Nrrdr`r_�:�rY)rSrZrZfor_stmt�_findr�r�Zif_stmtZ
while_stmtZtry_stmtror�COLONr�	_def_syms�_is_import_bindingr�r~r�)r r1r��childZretr<�iZkidrrr
r�isH
r�cCsT|g}|rP|��}|jdkr4|jtkr4|�|j�q|jtjkr|j|kr|SqdS)N�)�poprZ�_block_syms�extendrSrrr)r r1Znodesrrr
r��sr�cCs�|jtjkr�|s�|jd}|jtjkrx|jD]H}|jtjkrV|jdj|krt|Sq,|jtjkr,|j|kr,|Sq,nL|jtjkr�|jd}|jtjkr�|j|kr�|Sn|jtjkr�|j|kr�|Sn�|jtj	k�r�|r�t
|jd���|kr�dS|jd}|�rtd|��rdS|jtj
k�r0t||��r0|S|jtjk�rh|jd}|jtjk�r�|j|k�r�|Sn6|jtjk�r�|j|k�r�|S|�r�|jtjk�r�|SdS)Nrr`rdr_�as)rZrr�rSZdotted_as_namesZdotted_as_namerrrrR�str�stripr�rQZimport_as_name�STAR)r1r r�rTr�Zlastr<rrr
r��s@





r�)N)NN)N)N)N)N)N)5Zpgen2rZpytreerrZpygramrrr9rrrrrr!r'r*r$r2r4r8r:r=rBrErMrUr^rcrerfZconsuming_callsrrrurvrwrtr{r�r�r�r�r�r�r�r}r|r�r�r#r�r�r�rrrr
�<module>s^




�		-
*

Hacked By AnonymousFox1.0, Coded By AnonymousFox