Plan 9 from Bell Labs’s /usr/web/sources/contrib/jas/root/sys/lib/python2.7/lib2to3/fixes/fix_isinstance.pyc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


��Qc@sCdZddlmZddlmZdejfd��YZdS(s,Fixer that cleans up a tuple argument to isinstance after the tokens
in it were fixed.  This is mainly used to remove double occurrences of
tokens as a leftover of the long -> int / unicode -> str conversion.

eg.  isinstance(x, (int, long)) -> isinstance(x, (int, int))
       -> isinstance(x, int)
i(t
fixer_base(ttokent
FixIsinstancecBs#eZeZdZdZd�ZRS(s�
    power<
        'isinstance'
        trailer< '(' arglist< any ',' atom< '('
            args=testlist_gexp< any+ >
        ')' > > ')' >
    >
    icCsUt�}|d}|j}g}t|�}x�|D]�\}}	|	jtjkr�|	j|kr�|t|�dkr�||djtjkr�|j	�q5q�q5|j
|	�|	jtjkr5|j|	j�q5q5W|r|djtjkr|d=nt|�dkr@|j}
|
j
|d_
|
j|d�n||(|j�dS(Ntargsii�i(tsettchildrent	enumeratettypeRtNAMEtvaluetlentCOMMAtnexttappendtaddtparenttprefixtreplacetchanged(tselftnodetresultstnames_insertedttestlistRtnew_argstiteratortidxtargtatom((s2/sys/lib/python2.7/lib2to3/fixes/fix_isinstance.pyt	transforms*	
	!0
	

	(t__name__t
__module__tTruet
BM_compatibletPATTERNt	run_orderR(((s2/sys/lib/python2.7/lib2to3/fixes/fix_isinstance.pyRsN(t__doc__tRt
fixer_utilRtBaseFixR(((s2/sys/lib/python2.7/lib2to3/fixes/fix_isinstance.pyt<module>
s

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.