Your IP : 3.139.87.151


Current Path : /opt/alt/python310/lib64/python3.10/lib2to3/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/lib2to3/__pycache__/fixer_util.cpython-310.opt-2.pyc

o

6��ff;�@s�	ddlmZddlmZmZddlmZddlm	Z	dd�Z
dd�Zd	d
�Zdd�Z
dMdd�Zdd�Zdd�Zdd�Ze�e�fdd�ZdNdd�Zdd�Zdd�ZdMdd�Zd d!�ZdMd"d#�ZdMd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zhd0�Zd1d2�Z d3a!d4a"d5a#d6a$d7d8�Z%d9d:�Z&d;d<�Z'd=d>�Z(d?d@�Z)dAdB�Z*dCdD�Z+dEdF�Z,ej-ej.hZ/dMdGdH�Z0ej.ej-ej1hZ2dIdJ�Z3dMdKdL�Z4d
S)O�)�token)�Leaf�Node)�python_symbols)�patcompcCsttj|ttjd�|g�S)N�=)r�symsZargumentrr�EQUAL)�keyword�value�r�9/opt/alt/python310/lib64/python3.10/lib2to3/fixer_util.py�
KeywordArgs�rcC�ttjd�S)N�()rr�LPARrrrr
�LParen�rcCr)N�))rr�RPARrrrr
�RParenrrcCsJ	t|t�s	|g}t|t�sd|_|g}ttj|ttjddd�g|�S)N� r��prefix)	�
isinstance�listrrr�atomrrr	)�target�sourcerrr
�Assigns

�rNcC�	ttj||d�S�Nr)rr�NAME)�namerrrr
�Name$�r$cCs	|ttjt�|g�gS�N)rr�trailer�Dot)�obj�attrrrr
�Attr(sr+cC�	ttjd�S)N�,)rr�COMMArrrr
�Comma,�r/cCr,)N�.)rr�DOTrrrr
r(0r0r(cCs6	ttj|��|��g�}|r|�dttj|��|S)Nr)rrr'�clone�insert_child�arglist)�argsZlparenZrparen�noderrr
�ArgList4s
r8cCs(	ttj|t|�g�}|dur||_|Sr&)rr�powerr8r)Z	func_namer6rr7rrr
�Call;s
r:cCr,)N�
�rr�NEWLINErrrr
�NewlineBr0r>cCr,)N�r<rrrr
�	BlankLineFr0r@cCsttj||d�Sr!)rr�NUMBER)�nrrrr
�NumberJsrCcCs$	ttjttjd�|ttjd�g�S)N�[�])rrr'rr�LBRACE�RBRACE)Z
index_noderrr
�	SubscriptMs

�rHcCr r!)rr�STRING)�stringrrrr
�StringSr%rKc	Cs�	d|_d|_d|_ttjd�}d|_ttjd�}d|_||||g}|r;d|_ttjd�}d|_|�ttj||g��ttj|ttj	|�g�}ttj
ttjd�|ttjd�g�S)Nr?r�for�in�ifrDrE)
rrrr"�appendrrZcomp_ifZ	listmakerZcomp_forrrFrG)	Zxp�fp�it�testZfor_leafZin_leafZ
inner_argsZif_leaf�innerrrr
�ListCompWs*

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


�r\c	Cs�	|d��}|jtjkr|��}n	ttj|��g�}|d}|r(dd�|D�}ttjtt|d�t|d��ttj|d��||d��g�g|�}|j	|_	|S)	Nr)�aftercSsg|]}|���qSr)r3)�.0rBrrr
�
<listcomp>�sz!ImportAndCall.<locals>.<listcomp>�rZlparZrpar)
r3�typerr5rr9r+r$r'r)r7�results�namesr)Z
newarglistr]�newrrr
�
ImportAndCall�s,


�����recCs�	t|t�r|jt�t�gkrdSt|t�oDt|j�dkoDt|jdt�oDt|jdt�oDt|jdt�oD|jdjdkoD|jdjdkS)NT�r`r�rr)rrrZrr�lenrr�r7rrr
�is_tuple�s 
������rjcCsZ	t|t�o,t|j�dko,t|jdt�o,t|jdt�o,|jdjdko,|jdjdkS)Nrr`���rDrE)rrrhrZrrrirrr
�is_list�s
�����rlcCsttjt�|t�g�Sr&)rrrrrrirrr
�parenthesize�srm>
�allr�max�set�any�min�tuple�sorted�sum�	enumerateccs.�	t||�}|r|Vt||�}|s	dSdSr&)�getattr)r)r*�nextrrr
�
attr_chain�s�


�ryzefor_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*
>
FcCsr	tst�t�at�t�at�t�adatttg}t|t|d��D]\}}i}|�||�r6|d|ur6dSq!dS)NT�parentr7F)	�
pats_builtrZcompile_pattern�p0�p1�p2�zipry�match)r7�patterns�patternrzrbrrr
�in_special_context�s



�r�cCs�	|j}|dur|jtjkrdS|j}|jtjtjfvrdS|jtjkr-|j	d|ur-dS|jtj
ksJ|jtjkrL|durC|jtjksJ|j	d|urLdSdS)NFr`T)
Zprev_siblingrarr2rzr�funcdef�classdef�	expr_stmtrZZ
parametersZ
typedargslistr.)r7�prevrzrrr
�is_probably_builtin�sr�cCsR	|dur'|jtjkr t|j�dkr |jd}|jtjkr |jS|j}|dusdS)Nrgrr?)	rar�suiterhrZr�INDENTrrz)r7�indentrrr
�find_indentations
�r�cCs>|jtjkr|S|��}|jd}|_ttj|g�}||_|Sr&)rarr�r3rzr)r7rzr�rrr
�
make_suitesr�cCs0	|jtjkr|j}|std��|jtjks|S)Nz,root found before file_input node was found.)rarZ
file_inputrz�
ValueErrorrirrr
�	find_root&s�r�cCs	t|t|�|�}t|�Sr&)�find_bindingr��bool)�packager#r7Zbindingrrr
�does_tree_import/sr�cCs	|jtjtjfvSr&)rar�import_namerYrirrr
�	is_import7sr�cCs,	dd�}t|�}t|||�rdSd}}t|j�D]!\}}||�s#qt|j|d��D]
\}}||�s6nq,||}|dkrbt|j�D]\}}|jtjkra|jra|jdjtjkra|d}nqE|duryt	tj
ttjd�ttj|dd�g�}	nt
|ttj|dd�g�}	|	t�g}
|�|t	tj|
��dS)NcSs |jtjko|jot|jd�S)Nr`)rar�simple_stmtrZr�rirrr
�is_import_stmt>s�z$touch_import.<locals>.is_import_stmtr`rrVrr)r�r�rvrZrarr�rrIrr�rr"r\r>r4)r�r#r7r��rootZ
insert_pos�offset�idxZnode2�import_rZrrr
�touch_import;s<��
�
r�cCs�	|jD]�}d}|jtjkr*t||jd�r|St|t|jd�|�}|r)|}n�|jtjtjfvrCt|t|jd�|�}|rB|}nw|jtj	kr�t|t|jd�|�}|rY|}nat
|jdd��D] \}}|jtjkr�|j
dkr�t|t|j|d�|�}|r�|}qbn6|jtvr�|jdj
|kr�|}n&t|||�r�|}n|jtjkr�t|||�}n|jtjkr�t||jd�r�|}|r�|s�|St|�r�|SqdS)Nrrkrgrf�:�r`)rZrarZfor_stmt�_findr�r�Zif_stmtZ
while_stmtZtry_stmtrvr�COLONr�	_def_syms�_is_import_bindingr�r�r�)r#r7r��childZretrB�iZkidrrr
r�isN
�����r�cCsV|g}|r)|��}|jdkr|jtvr|�|j�n
|jtjkr'|j|kr'|S|sdS)N�)�popra�_block_syms�extendrZrr"r)r#r7Znodesrrr
r��s�r�cCs�	|jtjkrg|sg|jd}|jtjkr>|jD]$}|jtjkr,|jdj|kr+|Sq|jtjkr;|j|kr;|SqdS|jtjkrX|jd}|jtjkrV|j|krV|SdS|jtjkre|j|kre|SdS|jtj	kr�|r|t
|jd���|kr|dS|jd}|r�td|�r�dS|jtj
kr�t||�r�|S|jtjkr�|jd}|jtjkr�|j|kr�|SdS|jtjkr�|j|kr�|S|r�|jtjkr�|SdS)Nrrgrkrf�as)rarr�rZZdotted_as_namesZdotted_as_namerrr"rY�str�stripr�rXZimport_as_name�STAR)r7r#r�r[r�ZlastrBrrr
r��sN

���
��

�r�r&)NN)5Zpgen2rZpytreerrZpygramrrr?rrrrrr$r+r/r(r8r:r>r@rCrHrKrTr\rerjrlrmZconsuming_callsryr|r}r~r{r�r�r�r�r�r�r�r�r�r�r�r�r'r�r�r�rrrr
�<module>sZ




		-
*

?>