add-determinism 0.7.3

RPM buildroot helper to strip nondeterministic bits in files
Documentation
3

�
�^c@sJddlmZddlmZmZmZmZmZmZdZ	dZ
Gdd�dej�ZdS)i)�
fixer_base)�Call�Comma�Name�Node�	BlankLine�symsz0(n='!=' | '==' | 'is' | n=comp_op< 'is' 'not' >)z(power< 'type' trailer< '(' x=any ')' > >csPeZdZdZdeeeefZ�fdd�Zdd�Zdd�Z	d	d
�Z
dd�Z�ZS)
�	FixIdiomsTa�
        isinstance=comparison< %s %s T=any >
        |
        isinstance=comparison< T=any %s %s >
        |
        while_stmt< 'while' while='1' ':' any+ >
        |
        sorted=any<
            any*
            simple_stmt<
              expr_stmt< id1=any '='
                         power< list='list' trailer< '(' (not arglist<any+>) any ')' > >
              >
              '\n'
            >
            sort=
            simple_stmt<
              power< id2=any
                     trailer< '.' 'sort' > trailer< '(' ')' >
              >
              '\n'
            >
            next=any*
        >
        |
        sorted=any<
            any*
            simple_stmt< expr_stmt< id1=any '=' expr=any > '\n' >
            sort=
            simple_stmt<
              power< id2=any
                     trailer< '.' 'sort' > trailer< '(' ')' >
              >
              '\n'
            >
            next=any*
        >
    cs8tt|�j|�}|r4d|kr4|d|dkr0|SdS|S)N�sortedZid1Zid2)Zsuperr�match)�self�nodeZr�Z	__class__��0/usr/lib64/python3.6/lib2to3/fixes/fix_idioms.pyr	OszFixIdioms.matchcCsHd|kr|j||�Sd|kr(|j||�Sd|kr<|j||�Std��dS)N�
isinstance�whilerz
Invalid match)�transform_isinstance�transform_while�transform_sort�RuntimeError)r
r�resultsr
r
r�	transformZszFixIdioms.transformcCsh|dj�}|dj�}d|_d|_ttd�|t�|g�}d|kr\d|_ttjtd�|g�}|j|_|S)N�x�T�z rZnZnot)�clone�prefixrrrrrZnot_test)r
rrrrZtestr
r
rrdszFixIdioms.transform_isinstancecCs |d}|jtd|jd��dS)NrZTrue�r)�replacerr)r
rrZoner
r
rrpszFixIdioms.transform_whilecCs�|d}|d}|jd�}|jd�}|r>|jtd|jd��n8|rn|j�}d|_|jttd�|g|jd��ntd��|j�|j}d	|kr�|r�|jd	�d
|d
jf}	d	j	|	�|d
_n"t
�}
|jj|
�|jd	�d
|
_dS)NZsortZnextZlistZexprrrrzshould not have reached hereZ
i)
ZgetrrrrrrZremoveZ
rpartitionZjoinrZparentZappend_child)r
rrZ	sort_stmtZ	next_stmtZ	list_callZsimple_exprZnewZbtwnZprefix_linesZend_liner
r
rrts*

zFixIdioms.transform_sort)
Z__name__Z
__module__Z__qualname__Zexplicit�TYPE�CMPZPATTERNr	rrrrZ
__classcell__r
r
rrr%s'
rN)
rrZ
fixer_utilrrrrrrrrZBaseFixrr
r
r
rZ<module>s