HEX
Server: LiteSpeed
System: Linux baran.dnsprotection.me 4.18.0-553.83.1.lve.el8.x86_64 #1 SMP Wed Nov 12 10:04:12 UTC 2025 x86_64
User: ddir12 (3618)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: //lib/python3.6/site-packages/libpasteurize/fixes/__pycache__/fix_unpacking.cpython-36.opt-1.pyc
3

�c:�@s~dZddlmZddlmZddlmZmZmZm	Z	m
Z
mZmZm
Z
mZmZddlmZmZmZdd�ZGdd	�d	ej�Zd
S)zD
Fixer for:
(a,)* *b (,c)* [,] = s
for (a,)* *b (,c)* [,] in d: ...
�)�
fixer_base)�count)
�Assign�Comma�Call�Newline�Name�Number�token�syms�Node�Leaf)�indentation�suitify�	commatizecCs�g}t|�}t|�}|dkr�ttjt|�ttjttjd�ttj	ttj
d�t|�g�ttjd�g�g�}|j
|�|j
ttjddd��ttjttjddd�t|�ttjttjd�ttj	|dkr�t|�ntdd	�ttj
d�|dkr�ttjttjd
�t|�g�ntdd	�g�ttjd�ttjd�g�g�}|j
|�|dk�r�|j
ttjddd��ttjt|dd�ttjttjd�ttj	ttjttjd
�t|�g�ttj
d�g�ttjd�g�g�}	|j
|	�ttj|�}
|
S)z�
    Accepts num_pre and num_post, which are counts of values
    before and after the starg (not including the starg)
    Returns a source fit for Assign() from fixer_util
    r�[�:�]�+� )�prefix���-)ZunicoderrZpowerrZtrailerr
r
�LSQBZ	subscript�COLONr	�RSQB�append�PLUSZfactor�MINUSZ
arith_expr)Znum_preZnum_post�LISTNAME�ITERNAME�children�pre�postZpre_partZ	main_partZ	post_part�source�r&�#/usr/lib/python3.6/fix_unpacking.py�assignment_sourcesJ
�

b
r(c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�FixUnpackinga9
    expl=expr_stmt< testlist_star_expr<
        pre=(any ',')*
            star_expr< '*' name=NAME >
        post=(',' any)* [','] > '=' source=any > |
    impl=for_stmt< 'for' lst=exprlist<
        pre=(any ',')*
            star_expr< '*' name=NAME >
        post=(',' any)* [','] > 'in' it=any ':' suite=any>c
s��fdd�dD�\}}}}dd�|D�}d	|_d
d�|D�}dd�t||j�g|�D�}|jt��d|_tt|j�ttd
�|j�g��}t|t	t
|�t
|�|j|j��}	||	fS)Nc3s|]}�j|�VqdS)N)�get)�.0�n)�resultsr&r'�	<genexpr>3sz4FixUnpacking.fix_explicit_context.<locals>.<genexpr>r#�namer$r%cSs g|]}|jtjkr|j��qSr&)�typer
�NAME�clone)r+r,r&r&r'�
<listcomp>4sz5FixUnpacking.fix_explicit_context.<locals>.<listcomp>rcSs g|]}|jtjkr|j��qSr&)r0r
r1r2)r+r,r&r&r'r36scSsg|]}|j��qSr&)r2)r+r,r&r&r'r37sr�list)r#r/r$r%)rrr2rrrrr rr(�lenr!)
�self�noder-r#r/r$r%�target�
setup_line�
power_liner&)r-r'�fix_explicit_context2s   z!FixUnpacking.fix_explicit_contextcs��fdd�dD�\}}}}dd�|D�}d	|_d
d�|D�}dd�t||j�g|�D�}|jt��|j�}d|_tt|j�ttd
�t|j	�g��}	t|t
t|�t|�|j|j	��}
|	|
fS)z_
        Only example of the implicit context is
        a for loop, so only fix that.
        c3s|]}�j|�VqdS)N)r*)r+r,)r-r&r'r.Esz4FixUnpacking.fix_implicit_context.<locals>.<genexpr>r#r/r$�itcSs g|]}|jtjkr|j��qSr&)r0r
r1r2)r+r,r&r&r'r3Fsz5FixUnpacking.fix_implicit_context.<locals>.<listcomp>rcSs g|]}|jtjkr|j��qSr&)r0r
r1r2)r+r,r&r&r'r3HscSsg|]}|j��qSr&)r2)r+r,r&r&r'r3Isrr4)r#r/r$r<)rrr2rrrrr rr!r(r5)r6r7r-r#r/r$r<r8r%r9r:r&)r-r'�fix_implicit_context@s " z!FixUnpacking.fix_implicit_contextc
Cs@|jd�|_|jd�|_|jd�|jd�}}|dk	r�|j||�\}}|j|_t|j�|_|jt	��|j}|j
�}|j||�|j||�n�|dk	�r<|j||�\}}t
|�dd�|jD�d}	d	|_|	jd
j|_t|	jd�|	jd_|	jdt	��|	jd|�|	jdt	��|	jd|�|jd�jt|jd
d��dS)a�
        a,b,c,d,e,f,*g,h,i = range(100) changes to
        _3to2list = list(range(100))
        a,b,c,d,e,f,g,h,i, = _3to2list[:6] + [_3to2list[6:-2]] + _3to2list[-2:]

        and

        for a,b,*c,d,e in iter_of_iters: do_stuff changes to
        for _3to2iter in iter_of_iters:
            _3to2list = list(_3to2iter)
            a,b,c,d,e, = _3to2list[:2] + [_3to2list[2:-2]] + _3to2list[-2:]
            do_stuff
        Z	_3to2listZ	_3to2iter�expl�implNcSsg|]}|jtjkr|�qSr&)r0r�suite)r+�kr&r&r'r3psz*FixUnpacking.transform.<locals>.<listcomp>rrr�Zlstr)r)�new_namer r!r*r;rr�parentZappend_childr�removeZinsert_childr=rr"�value�replacer)
r6r7r-r>r?r9r:rD�ir@r&r&r'�	transformSs0
zFixUnpacking.transformN)�__name__�
__module__�__qualname__ZPATTERNr;r=rIr&r&r&r'r)&s
r)N)�__doc__Zlib2to3r�	itertoolsrZlib2to3.fixer_utilrrrrrr	r
rrr
Zlibfuturize.fixer_utilrrrr(ZBaseFixr)r&r&r&r'�<module>s0