Your IP : 3.144.121.241


Current Path : /lib64/python2.7/lib2to3/fixes/
Upload File :
Current File : //lib64/python2.7/lib2to3/fixes/fix_filter.pyc

�
�mec@sedZddlmZddlmZddlmZmZmZm	Z	dej
fd��YZdS(s�Fixer that changes filter(F, X) into list(filter(F, X)).

We avoid the transformation if the filter() call is directly contained
in iter(<>), list(<>), tuple(<>), sorted(<>), ...join(<>), or
for V in <>:.

NOTE: This is still not correct if the original code was depending on
filter(F, X) to return a string if X is a string and a tuple if X is a
tuple.  That would require type inference, which we don't do.  Let
Python 2.6 figure it out.
i(ttoken(t
fixer_base(tNametCalltListComptin_special_contextt	FixFiltercBs#eZeZdZdZd�ZRS(s�
    filter_lambda=power<
        'filter'
        trailer<
            '('
            arglist<
                lambdef< 'lambda'
                         (fp=NAME | vfpdef< '(' fp=NAME ')'> ) ':' xp=any
                >
                ','
                it=any
            >
            ')'
        >
    >
    |
    power<
        'filter'
        trailer< '(' arglist< none='None' ',' seq=any > ')' >
    >
    |
    power<
        'filter'
        args=trailer< '(' [any] ')' >
    >
    sfuture_builtins.filtercCs|j|�rdSd|krst|jd�j�|jd�j�|jd�j�|jd�j��}n}d|kr�ttd�td�|dj�td��}n=t|�r�dS|j�}d|_ttd	�|g�}|j|_|S(
Nt
filter_lambdatfptittxptnoneu_ftsequulist(	tshould_skipRtgettcloneRRtNonetprefixR(tselftnodetresultstnew((s0/usr/lib64/python2.7/lib2to3/fixes/fix_filter.pyt	transform5s&	
	(t__name__t
__module__tTruet
BM_compatibletPATTERNtskip_onR(((s0/usr/lib64/python2.7/lib2to3/fixes/fix_filter.pyRsN(t__doc__tpgen2RtRt
fixer_utilRRRRtConditionalFixR(((s0/usr/lib64/python2.7/lib2to3/fixes/fix_filter.pyt<module>s"