Viewing File: /opt/alt/python35/lib64/python3.5/lib2to3/fixes/__pycache__/fix_idioms.cpython-35.opt-2.pyc



]@sgddlmZddlmZmZmZmZmZmZdZ	dZ
GdddejZdS))
fixer_base)CallCommaNameNode	BlankLinesymsz0(n='!=' | '==' | 'is' | n=comp_op< 'is' 'not' >)z(power< 'type' trailer< '(' x=any ')' > >csneZdZdZdeeeefZfddZddZddZ	d	d
Z
ddZS)
	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*
        >
    csJtt|j|}|rFd|krF|d|dkrB|SdS|S)NsortedZid1Zid2)superr	match)selfnoder)	__class__//opt/alt/python35/lib64/python3.5/fix_idioms.pyrOszFixIdioms.matchcCsdd|kr|j||Sd|kr8|j||Sd|krT|j||StddS)N
isinstancewhiler
z
Invalid match)transform_isinstancetransform_whiletransform_sortRuntimeError)r
rresultsrrr	transformZszFixIdioms.transformcCs|dj}|dj}d|_d|_ttd|t|g}d|krd|_ttjtd|g}|j|_|S)NxT rnnot)cloneprefixrrrrrZnot_test)r
rrrrZtestrrrrds		!	zFixIdioms.transform_isinstancecCs*|d}|jtdd|jdS)NrTruer")replacerr")r
rrZonerrrrps
zFixIdioms.transform_whilecCs:|d}|d}|jd}|jd}|rW|jtdd|jnR|r|j}d|_|jttd|gd|jntd|j|j}d	|kr6|r|jd	d
|d
jf}	d	j	|	|d
_n/t
}
|jj|
|jd	d
|
_dS)Nsortnextlistexprr
r"rzshould not have reached here
)
getr$rr"r!rrremove
rpartitionjoinrparentZappend_child)r
rrZ	sort_stmtZ	next_stmtZ	list_callZsimple_exprnewZbtwnZprefix_linesZend_linerrrrts*

	
	 	zFixIdioms.transform_sort)__name__
__module____qualname__ZexplicitTYPECMPZPATTERNrrrrrrr)rrr	%s'
r	N)
rrZ
fixer_utilrrrrrrr5r4ZBaseFixr	rrrr<module>s.
Back to Directory File Manager