Hacked By AnonymousFox

Current Path : /opt/alt/python35/lib64/python3.5/lib2to3/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/lib2to3/__pycache__/fixer_util.cpython-35.opt-2.pyc



���]�;�
@spddlmZddlmZddlmZmZddlmZ	ddl
mZdd�Zd	d
�Z
dd�Zd
d�Zddd�Zdd�Zdd�Zdd�Ze
�e�dd�Zdddd�Zdd�Zdd�Zdd d!�Zd"d#�Zdd$d%�Zdd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Z d2d3d4d5d6d7d8d9d:d;h
Z!d<d=�Z"d>a#d?a$d@a%dAa&dBdC�Z'dDdE�Z(dFdG�Z)dHdI�Z*dJdK�Z+dLdM�Z,dNdO�Z-dPdQ�Z.e	j/e	j0hZ1ddRdS�Z2e	j0e	j/e	j3hZ4dTdU�Z5ddVdW�Z6dS)X�)�islice�)�token)�Leaf�Node)�python_symbols)�patcompcCs%ttj|ttjd�|g�S)N�=)r�syms�argumentrr�EQUAL)�keyword�value�r�//opt/alt/python35/lib64/python3.5/fixer_util.py�
KeywordArgs	rcCsttjd�S)N�()rr�LPARrrrr�LParensrcCsttjd�S)N�))rr�RPARrrrr�RParensrcCsft|t�s|g}t|t�s9d|_|g}ttj|ttjddd�g|�S)N� r	�prefix)	�
isinstance�listrrr
�atomrrr)�target�sourcerrr�Assigns				rNcCsttj|d|�S)Nr)rr�NAME)�namerrrr�Name&sr"cCs|ttjt�|g�gS)N)rr
�trailer�Dot)�obj�attrrrr�Attr*sr'cCsttjd�S)N�,)rr�COMMArrrr�Comma.sr*cCsttjd�S)N�.)rr�DOTrrrrr$2sr$cCsJttj|j�|j�g�}|rF|jdttj|��|S)Nr)rr
r#�clone�insert_child�arglist)�argsZlparenZrparen�noderrr�ArgList6s$r2cCs7ttj|t|�g�}|dk	r3||_|S)N)rr
�powerr2r)�	func_namer0rr1rrr�Call=s	r5cCsttjd�S)N�
)rr�NEWLINErrrr�NewlineDsr8cCsttjd�S)N�)rrr7rrrr�	BlankLineHsr:cCsttj|d|�S)Nr)rr�NUMBER)�nrrrr�NumberLsr=cCs1ttjttjd�|ttjd�g�S)N�[�])rr
r#rr�LBRACE�RBRACE)Z
index_noderrr�	SubscriptOsrBcCsttj|d|�S)Nr)rr�STRING)�stringrrrr�StringUsrEc	Csd|_d|_d|_ttjd�}d|_ttjd�}d|_||||g}|r�d|_ttjd�}d|_|jttj||g��ttj|ttj	|�g�}ttj
ttjd�|ttjd�g�S)Nr9r�for�in�ifr>r?)
rrrr �appendrr
Zcomp_ifZ	listmakerZcomp_forrr@rA)	Zxp�fp�itZtestZfor_leafZin_leafZ
inner_argsZif_leaf�innerrrr�ListCompYs$							$	rMcCsx|D]}|j�qWttjd�ttj|dd�ttjddd�ttj|�g}ttj|�}|S)N�fromrr�import)�removerrr rr
�import_as_names�import_from)Zpackage_nameZ
name_leafsZleaf�children�imprrr�
FromImportqs
rUc	Cs�|dj�}|jtjkr1|j�}nttj|j�g�}|d}|rodd�|D�}ttjtt|d�t|d��ttj|dj�||dj�g�g|�}|j	|_	|S)	Nr%�aftercSsg|]}|j��qSr)r-)�.0r<rrr�
<listcomp>�s	z!ImportAndCall.<locals>.<listcomp>rrZlparZrpar)
r-�typer
r/rr3r'r"r#r)r1�results�namesr%Z
newarglistrV�newrrr�
ImportAndCall�s
	Z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�rr�rr)rrrSrr�lenrr)r1rrr�is_tuple�s*racCszt|t�oyt|j�dkoyt|jdt�oyt|jdt�oy|jdjdkoy|jdjdkS)Nrrr>r?���rb)rrr`rSrr)r1rrr�is_list�srccCsttjt�|t�g�S)N)rr
rrr)r1rrr�parenthesize�srd�sortedr�set�any�all�tuple�sum�min�max�	enumerateccs4t||�}x|r/|Vt||�}qWdS)N)�getattr)r%r&�nextrrr�
attr_chain�s	rpzefor_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*
>
FcCs�ts9tjt�atjt�atjt�adatttg}xRt|t|d��D]8\}}i}|j||�ra|d|kradSqaWdS)NT�parentr1F)	�
pats_builtrZcompile_pattern�p0�p1�p2�ziprp�match)r1�patterns�patternrqrZrrr�in_special_context�s%"rzcCs�|j}|dk	r+|jtjkr+dS|j}|jtjtjfkrSdS|jtjkr||j	d|kr|dS|jtj
ks�|jtjkr�|dk	r�|jtjks�|j	d|kr�dSdS)NFrT)
Zprev_siblingrYrr,rqr
�funcdef�classdef�	expr_stmtrSZ
parametersZ
typedargslistr))r1�prevrqrrr�is_probably_builtin�s		%rcCsmxf|dk	rh|jtjkr\t|j�dkr\|jd}|jtjkr\|jS|j}qWdS)Nr_rr9)	rYr
�suiter`rSr�INDENTrrq)r1�indentrrr�find_indentations'

r�cCsW|jtjkr|S|j�}|jd}|_ttj|g�}||_|S)N)rYr
r�r-rqr)r1rqr�rrr�
make_suites	r�cCs8x1|jtjkr3|j}|std��qW|S)Nz,root found before file_input node was found.)rYr
Z
file_inputrq�
ValueError)r1rrr�	find_root(s
	r�cCs"t|t|�|�}t|�S)N)�find_bindingr��bool)�packager!r1Zbindingrrr�does_tree_import1sr�cCs|jtjtjfkS)N)rYr
�import_namerR)r1rrr�	is_import9sr�cCs�dd�}t|�}t|||�r.dSd}}xnt|j�D]]\}}||�scqHx4t|j|d��D]\}}||�s}Pq}W||}PqHW|dkrx\t|j�D]K\}}|jtjkr�|jr�|jdjtjkr�|d}Pq�W|dkrYt	tj
ttjd�ttj|dd�g�}	n$t
|ttj|dd�g�}	|	t�g}
|j|t	tj|
��dS)NcSs,|jtjko+|jo+t|jd�S)Nr)rYr
�simple_stmtrSr�)r1rrr�is_import_stmt@sz$touch_import.<locals>.is_import_stmtrrrOrr)r�r�rmrSrYr
r�rrCrr�rr rUr8r.)r�r!r1r��rootZ
insert_pos�offset�idxZnode2�import_rSrrr�touch_import=s4
&

	!$r�cCs<x5|jD]*}d}|jtjkrpt||jd�rB|St|t|jd�|�}|r|}n�|jtjtjfkr�t|t|jd�|�}|r|}n[|jtj	krvt|t|jd�|�}|r�|}qxt
|jdd��D]\\}}|jtjkr|j
dkrt|t|j|d�|�}|r|}qWn�|jtkr�|jdj
|kr�|}npt|||�r�|}nU|jtjkr�t|||�}n.|jtjkrt||jd�r|}|r
|s$|St|�r
|Sq
WdS)	Nrr_r^�:�rrbrb)rSrYr
Zfor_stmt�_findr�r�Zif_stmtZ
while_stmtZtry_stmtrmr�COLONr�	_def_syms�_is_import_bindingr�r}r�)r!r1r��child�retr<�iZkidrrrr�ksH			&!#
%		r�cCs||g}xl|rw|j�}|jdkrO|jtkrO|j|j�q|jtjkr|j|kr|SqWdS)N�)�poprY�_block_syms�extendrSrr r)r!r1Znodesrrrr��s		!r�cCs$|jtjkr|r|jd}|jtjkr�x�|jD]Z}|jtjkrw|jdj|kr�|SqB|jtjkrB|j|krB|SqBWq |jtjkr�|jd}|jtjkr|j|kr|Sq |jtjkr |j|kr |Sn|jtj	kr |rMt
|jd�j�|krMdS|jd}|rstd|�rsdS|jtj
kr�t||�r�|S|jtjkr�|jd}|jtjkr |j|kr |SnA|jtjkr|j|kr|S|r |jtjkr |SdS)Nrr_r^�asrb)rYr
r�rSZdotted_as_namesZdotted_as_namerrr rR�str�stripr�rQZimport_as_name�STAR)r1r!r�rTr�Zlastr<rrrr��s@
!
!!%
!
!!r�)7�	itertoolsrZpgen2rZpytreerrZpygramrr
r9rrrrrr"r'r*r$r2r5r8r:r=rBrErMrUr]rarcrdZconsuming_callsrprsrtrurrrzrr�r�r�r�r�r�r|r{r�r�r#r�r�r�rrrr�<module>sZ		-*

Hacked By AnonymousFox1.0, Coded By AnonymousFox