ok

Mini Shell

Direktori : /opt/alt/python36/lib64/python3.6/lib2to3/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/lib2to3/__pycache__/fixer_util.cpython-36.opt-2.pyc

3

��2ag;�
@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
�//opt/alt/python36/lib64/python3.6/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|j�|j�g�}|r0|jdttj|��|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|_|jttj||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]}|j�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�|dj�}|jtjkr"|j�}nttj|j�g�}|d}|rNdd�|D�}ttjtt|d�t|d��ttj|dj�||dj�g�g|�}|j	|_	|S)	Nr#�aftercSsg|]}|j��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)NrrVr;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&tjt�atjt�atjt�adatttg}x<t|t|d��D](\}}i}|j||�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|j�}|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}
|j|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ko�|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\�:�rVr`r`)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|j�}|jdkr6|jtkr6|j|j�q|jtjkr|j|kr|SqWdS)N�)�poprW�_block_syms�extendrPrrr)rr/Znodesr
r
rr��sr�cCs�|jtjkr�|r�|jd}|jtjkrvx�|jD]@}|jtjkrV|jdj|krp|Sq0|jtjkr0|j|kr0|Sq0WnL|jtjkr�|jd}|jtjkr�|j|kr�|Sn|jtjkr�|j|kr�|Sn�|jtj	k�r�|r�t
|jd�j�|kr�dS|jd}|�rtd|��rdS|jtj
k�r.t||��r.|S|jtjk�rf|jd}|jtjk�r�|j|k�r�|Sn6|jtjk�r�|j|k�r�|S|�r�|jtjk�r�|SdS)Nrr]r\�asr`)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





		-
*

Zerion Mini Shell 1.0